1、在Form设计中,找到事件,选择 Form1_KeyDown 事件,回车确定。补充代码
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.ControlKey:
break;
}
}
2、在Form中,找到 KeyPreview ,选择为 True
标签:Form,C#,KeyDown,键盘,Keys,Form1,事件,KeyCode
来源: https://www.cnblogs.com/sethnie/p/15864935.html