110,538
社区成员
发帖
与我相关
我的任务
分享
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Thread thread;
private delegate void DelText(string text);
private void Form1_Load(object sender, EventArgs e)
{
thread = new Thread(new ThreadStart(showText));
thread.Start();
}
private void showText()
{
for (long i = 0; i <= 1000000000; i++)
{
this.Invoke(new DelText(setText),new object[]{i.ToString()});
}
}
private void setText(string text)
{
label1.Text = text;
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
thread.Abort();
}
}