这妞不错!

会有那么一天...

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

protected override void WndProc(ref Message m)
        {
            const int WM_SYSCOMMAND = 0x0112;
            const int SC_CLOSE = 0xF060;
            if (m.Msg == WM_SYSCOMMAND && (int)m.WParam == SC_CLOSE)
            {
                //窗体最小化
                //this.WindowState = FormWindowState.Maximized;
                //return;

                //询问是否关闭窗体
                if (DialogResult.No == MessageBox.Show("确定要关闭吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    return;
                }
            }

            base.WndProc(ref m);
        }

posted on 2013-08-01 11:00  这妞不错  阅读(183)  评论(0编辑  收藏  举报