private void change()
{
this.label1.Text = "已发生变化";
}
private void threadchange() //通过委托处理,MSDN上又很详细用法的说明
{
MethodInvoker In = new MethodInvoker(change);
this.BeginInvoke(In);
}
private void button1_Click(object sender, EventArgs e)
{
Thread cha = new Thread(new ThreadStart(threadchange));
cha.Start();
}
private void button2_Click(object sender, EventArgs e)
{
Thread th = new Thread(change);//出现错误,不是主线程内调用。
th.Start();
}
转载于:https://www.cnblogs.com/lingda/archive/2011/07/13/2104844.html