0

是否可以使用 Windowsform 的 Close[X]box 跳过验证?像这样的按钮,当点击时跳过验证

private void button1_Click(object sender, EventArgs e)
{
   AutoValidate = AutoValidate.Disable;
   Close();
}
4

1 回答 1

0

https://stackoverflow.com/a/16544523/2322994

protected override void WndProc(ref Message m) {
    // Intercept WM_SYSCOMMAND, SC_CLOSE
    if (m.Msg == 0x112 && (m.WParam.ToInt32() & 0xfff0) == 0xf060) this.AutoValidate =   AutoValidate.Disable;
    base.WndProc(ref m);
}
于 2013-05-14T17:06:29.757 回答