c#禁止窗口关闭方法,第1张

c#禁止窗口关闭方法,第2张

(1)直接将
窗口样式中的ControlBox设置为False,可以去掉右上角的十字
(2)重写关闭事件
private void form 1 _ form closing(object sender,form closing eventagers e)
{
dialog result;
result = MessageBox。Show("你确定要退出吗?",“退出”,messageboxbuttons.okcancel,messagebox icon . question);
if (result == DialogResult。好)
{
申请。exit thread();
}
else
{
e . Cancel = true;
}
}

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » c#禁止窗口关闭方法

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情