且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C#中禁用或消失Windows窗体标题中的退出按钮

更新时间:2022-12-23 14:03:59

如果将窗体的ControlBox属性设置为false,则所有三个按钮(最小化,最大化和关闭)将会消失.

其他方法是在Allan Chong提供的链接中.

第三种可能的方法是处理Closing事件并设置
If you set ControlBox property of the form to false, all three buttons (minimize, maximise and close) will go off.

Other way would be at the link Allan Chong provided.

And third possible way is to handle Closing event and set
e.Cancel = true;


第三种方法可能是***的,因为您可以在取消关闭事件和/或根据需要进行日志记录之前警告用户,然后决定是否关闭它.

-Milind


This third way might be the best as you can warn the user before cancelling the close event and/or do logging as required and then make decision whether to let it close or not.

-Milind


查看此处: )