检查
InvokeRequired中的
Control类,并且如果这是真的,然后调用
Invoke和传递,你想要给客户端的线程上做一个委托(通常是匿名方法)。
例:
public void DoWork(Form form){ if (form.InvokeRequired) { // We're on a thread other than the GUI thread form.Invoke(new MethodInvoker(() => DoWork(form))); return; } // Do what you need to do to the form here form.Text = "Foo";}


