[WinForm]使关闭按钮不可用或隐藏
时间:2014-07-07 09:33:54
收藏:0
阅读:254
关键代码:
/// <summary> /// 代码源自:http://www.codeproject.com/Articles/20379/Disabling-Close-Button-on-Forms /// </summary> private const int CP_NOCLOSE_BUTTON = 0x200; protected override CreateParams CreateParams { get { CreateParams _createParams = base.CreateParams; _createParams.ClassStyle = _createParams.ClassStyle | CP_NOCLOSE_BUTTON; return _createParams; } }
代码效果:
或者设置ControlBox属性来隐藏,如图:
希望有所帮助!
评论(0)