c# winform程序运行时禁止点x关闭

如题所述

重写protected override void OnClosing(CancelEventArgs e)加上代码e.Cancel = true;

如:
protected override void OnClosing(CancelEventArgs e)
{
MessageBox.Show(“我点击了关闭按钮”);
e.Cancel = true;

}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-06-30
在onclosing事件中加入代码 e.Cancel = true;
相似回答