标签:按钮 button 分享 col pre event system 图片 orm
1.代码结构
2.实现代码
using System; using System.Windows.Forms; namespace WinFormForbidCloseDemo { /// <summary> /// WinForm禁用窗体的关闭按钮 /// LDH @ 2018-5-19 /// </summary> public partial class FrmMain : Form { public FrmMain() { InitializeComponent(); } /// <summary> /// 关闭窗体 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClose_Click(object sender, EventArgs e) { Environment.Exit(0); } #region 【WinForm禁用窗体的关闭按钮】 private const int CP_NOCLOSE_BUTTON = 0x200; protected override CreateParams CreateParams { get { var myCp = base.CreateParams; myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON; return myCp; } } #endregion } }
3.效果展示
标签:按钮 button 分享 col pre event system 图片 orm
原文地址:https://www.cnblogs.com/LifeDecidesHappiness/p/9060000.html