winform线程委托给主线程

1.
1      private void Add()
2         {
3             if (this.InvokeRequired)
4             {
5                 this.Invoke(new MethodInvoker(delegate { Add(); }));
6                 return;
7             }
8            //代码
9         }                    

 


2.
  ThreadPool.QueueUserWorkItem(new WaitCallback((obj) =>
                             {

                         }));

 

  

转载于:https://www.cnblogs.com/junhuang/p/5681188.html

你可能感兴趣的:(winform线程委托给主线程)