C#键盘消息
程序员文章站
2024-03-13 12:36:09
...
在窗体建立KeyDown的键盘消息:
运行,总有文本框自动获取焦点,所以设置窗体属性
private void Form4_KeyDown(object sender, KeyEventArgs e)
{
textBox1.Text =
"Alt: " + (e.Alt ? "Yes " : "No ") +
"Control: " + (e.Control ? "Yes " : "No ") +
"Shift: " + (e.Shift ? "Yes " : "No ");
//if (Keys.M == e.KeyCode)
textBox1.Text += " " + e.KeyCode.ToString();
}