可以定义个变量么
private bool threadCanStop = false;void InvokeShowLight()
{
      while(true)
      {
             Monitor.Enter(threadCanStop);
             if(threadCanStop) break;
             Monitor.Exit(threadCanStop);
             ..你的线程代码
      }
}
如果你需要线程运行完停止了,就设置
             Monitor.Enter(threadCanStop);
             threadCanStop = true;
             Monitor.Exit(threadCanStop);

解决方案 »

  1.   

    private bool threadCanStop = true;void InvokeShowLight()
    {
          while(threadCanStop)
          {
                 ..你的线程代码
          }
    }在主线程中只要设置threadCanStop=false就可以退出该线程。
      

  2.   

    wuyazhe(接单:wince应用软件/上位机(串口,usb)软件) 
    正解~~~
      

  3.   

    你要先让指定是在新加的行上
    再用CurrentCell指定那列
    就可以取它的值
      

  4.   


    private ManualResetEvent threadCanStop = new ManualResetEvent (false);void InvokeShowLight()
    {
          while(!threadCanStop.WaitOne(100,false))
          {
             //做你的工作.
          }
    }//如果你需要线程运行完停止了,就设置
    threadCanStop.Set();
    threadCanStop.WaitOne(100,false): 意思是等待100毫秒,如果threadCanStop被主线程Set了,就返回true,从而退出while. 这里等待100毫秒是关键,如果写一个没有等待的While循环,CPU负荷太大,通常会上到100%.
      

  5.   

    写在回调函数里,如果满足你的条件,重新Start线程,不满足,则退出