c#禁止窗口关闭方法
(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;
}
}
0条评论