C#跨线程操作控件 无参数传递
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(); }