具体实现如下,添加窗体closing事件,代码为:
复制代码 代码示例:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.TaskManagerClosing|| e.CloseReason == CloseReason.ApplicationExitCall)
{
e.Cancel = true;
this.ShowInTaskbar = false;
this.Hide();
}
}
有兴趣的朋友,抓紧试试吧。