lhy5678888
这是对整个界面的快捷键的设置,比如查询,保存。
1
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) 2 { 3 if (keyData == Keys.F2) 4 { 5 if (btnSelect.Enabled) 6 { 7 btnSelect_Click(null, EventArgs.Empty); 8 return true;//这里return true 否则控件焦点会跟着方向键改变 9 } 10 } 11 else if (keyData == Keys.F4) 12 { 13 if (btnSave.Enabled) 14 { 15 btnSave_Click(null, EventArgs.Empty); 16 return true;//这里return true 否则控件焦点会跟着方向键改变 17 } 18 } 19 return base.ProcessCmdKey(ref msg, keyData);//这句保证其它按键能正常使用 20 }

 

分类:

技术点:

相关文章:

  • 2021-11-22
  • 2022-03-01
  • 2021-10-17
  • 2022-02-06
  • 2021-10-17
  • 2021-10-17
  • 2021-06-18
  • 2021-09-24
猜你喜欢
  • 2021-11-14
  • 2022-12-23
  • 2021-10-15
  • 2021-08-18
  • 2021-08-19
  • 2021-11-03
相关资源
相似解决方案