using System.ComponentModel; using System.Windows.Forms; using Microsoft.Windows.Forms; namespace Update.Controls { /// /// 屏蔽 Alt + F4 窗口 /// public class BaseForm : UIForm { private bool m_UserClosing; /// /// 显示窗口 /// /// 父窗口 public virtual void ShowCore(IWin32Window owner) { this.Show(owner); } /// /// 关闭窗口 /// public virtual void CloseCore() { this.m_UserClosing = true; this.Close(); } /// /// 关闭 /// /// 数据 protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); e.Cancel = !this.m_UserClosing; this.m_UserClosing = false; } } }