...
1 /// <summary> 2 /// 重寫鍵盤處理事件,處理退出和回車按鈕 3 /// </summary> 4 protected override bool ProcessCmdKey(ref Message msg, Keys keyData) 5 { 6 switch (keyData) 7 { 8 // 保存並退出 9 case Keys.Escape://ESC 10 BtnOK_Click(null, null); 11 break; 12 13 case Keys.Enter: 14 BtnCancel_Click(null, null); 15 break; 16 } 17 return base.ProcessCmdKey(ref msg, keyData); 18 }