我在复选框控件事件中设置了一个线程,,想实现不勾选复选框时结束线程,我添加了thread.Abort(),但是线程没有实现结束的效果,想问一下需要怎么修改呢?
```c#
Thread timethread = new Thread(new ThreadStart(senddate));
timethread.IsBackground = true;
timethread.Start();
ThreadStopFlg = true; //线程标志位
if (cbxtime.Checked == true)
{
tm.Start();
}
else
{
tm.Stop();
timethread.Abort();
while ((timethread.ThreadState != System.Threading.ThreadState.Stopped)&&(timethread.ThreadState != System.Threading.ThreadState.Aborted))
{
Thread.Sleep(1000);
}
}
```