C#在关闭窗体的时候,有时线程还在后台执行,没有及时退出。

处理方案:

  为Form添加FormClosing事件,加入以下语句,在退出时,杀死本进程。

 

System.Diagnostics.Process.GetCurrentProcess().Kill();
 
----------------------------------------------------------------------------------
 

System.Environment.Exit(0);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2021-12-06
  • 2021-09-28
  • 2022-12-23
猜你喜欢
  • 2021-12-24
  • 2021-11-23
  • 2022-12-23
  • 2021-09-20
相关资源
相似解决方案