实现效果:
知识运用:
KeyEventArgs类的KeyCode属性
实现代码:
private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F2) MessageBox.Show("你按下了F2键","提示",MessageBoxButtons.OK); }