日期:2014-05-17 浏览次数:21059 次
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
return (keyData & Keys.Alt) != 0;
}
public class TestForm : Form
{
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
return (keyData & Keys.Alt) != 0;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
TextBox tx = new TextBox();
this.Controls.Add(tx);
tx.Text = "你尝试按Alt+F4?";
tx.SelectionStart = tx.Text.Length;
}
}
protected override void WndProc(ref Message m)
{
const int WM_SYSCOMMAND = 0x112;
const int SC_CLOSE = 0xF060;
if (m.Msg == WM_SYSCOMMAND && m.WParam == (IntPtr)SC_CLOSE && m.LParam == IntPtr.Zero)
return;
base.WndProc(ref m);
}
protected override void WndProc(ref Message m)
{