Winform
组合键响应处理:
//Support Shortcut Key
private void MainForm_KeyUp(object sender, KeyEventArgs e)
{
if ((e.Modifiers & Keys.Control) != 0 && e.KeyCode == Keys.G)
{
FrmGoto frmGoto = new FrmGoto();
frmGoto.StartPosition = FormStartPosition.CenterScreen;
frmGoto.Show();
}
}
设置Form 窗体中默认的回车及ESC处理:
在窗体的Designer.cs或者Form.Load事件中加入
this.AcceptButton = this.btnOK; 响应Enter
this.CancelButton = this.btnCancel; 响应ESC
转载于:https://www.cnblogs.com/fery/archive/2013/02/18/2915260.html