当前位置: 编程技术>.net/c#/asp.net
C# 窗体隐藏及任务管理器中禁止关闭的实现代码
来源: 互联网 发布时间:2014-08-30
本文导语: 具体实现如下,添加窗体closing事件,代码为: 代码示例: private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.TaskManagerClosing|| e.CloseReason == CloseReason.ApplicationExitCall) { e.Cancel = ...
具体实现如下,添加窗体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();
}
}
{
if (e.CloseReason == CloseReason.TaskManagerClosing|| e.CloseReason == CloseReason.ApplicationExitCall)
{
e.Cancel = true;
this.ShowInTaskbar = false;
this.Hide();
}
}
有兴趣的朋友,抓紧试试吧。