在C#中如何关闭线程?
在C#中关闭线程,分两种情况: 第一种情况是关闭自己,可以使用System.Threading.Thread.CurrentThread.Abort(); Process.GetCurrentProcess().Kill() Application.ExitThread(); 不过以上方法,都是强制直接退出了整个程序,不只是关闭子窗体。 另外一种情况是关闭其它线程,要是关闭其它线程可以这样操作:在Thread 这个类里边写Close方法。然后。在private void button2_Click(object sender, EventArgs e)里写thread.Close();就可以了。 所以要区分是关闭哪个进行,才可以选择对应的方法。