const int WM_SYSCOMMAND = 0x0112;
const int SC_CLOSE = 0xF060;
protected override void WndProc(ref Message msg)
{
if (msg.Msg == WM_SYSCOMMAND && ((int)msg.WParam == SC_CLOSE))
{
// 点击winform右上关闭按钮
return;
}
base.WndProc(ref msg);
}
winfrom 捕获是否点击关闭按钮关闭的窗体
时间: 2024-10-12 08:16:15