1、将Form的KeyPreview属性设置True

2、对KeyDown事件写入代码
 private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                MessageBox.Show("你按下了F2键");
                //解发button1的单击事件
                button1_Click(bt_save, null);
            }

        }

相关文章:

  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-12-16
猜你喜欢
  • 2021-09-11
  • 2022-02-13
  • 2022-12-23
  • 2021-10-08
  • 2021-06-24
相关资源
相似解决方案