登录后复制 /// <summary> /// 监听手动关闭事件 /// </summary> /// <param name="msg"></param> protected override void WndProc(ref Message msg) { const int WM_SYSCOMMAND = 0x0112; const int SC_CLOSE = 0xF060; if (msg.Msg == WM_SYSCOMMAND && ((int)msg.WParam == SC_CLOSE)) // 点击框架右上关闭按钮时 { Environment.Exit(0); } else{ // close()、windowapi通知该窗体关闭、windowapi强制关闭、异常关闭等事件 } base.WndProc(ref msg); } 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17. 作者:꧁执笔小白꧂ 原创作者: u_16822845 转载于: https://blog.51cto.com/u_16822845/11651004