c# WinForm窗體編程中對窗體程序設置快捷鍵 首先設置: this.KeyPreview = true;//為了使OnKeyDown事件有效 (這個設置可以在Form屬性中IDE中設置,也可以在代碼中設置。) 然后添加如下代碼: /// <summary> /// 實現摁下Ctrl+F,進行查找的功能。 /// </summary> /// <param name="e"></param> protected override void OnKeyDown(KeyEventArgs e) { //ctrl+f 查找 if (e.Control & e.KeyCode == Keys.F)//ctrl+f { //這里寫你摁下Ctrl+F之后所要進行的動作的代碼 } }