C#重写按键监听

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Escape)
            {
                simpleButton2_Click(null, null);
            }
            else if (keyData == Keys.Enter)
            {
                simpleButton1_Click(null, null);
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

 

你可能感兴趣的:(C#winfrom)