键盘快捷键不起作用 [英] keyboard short cut key not working
本文介绍了键盘快捷键不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void MDIParent1_KeyDown(object s, KeyEventArgs e)
{
if (e.Control && e.KeyCode.ToString() == "q")
{
MessageBox.Show("welcome");
this.KeyPreview = false;
}
}
当我按ctrl+q
时,消息框应该显示.,我使用了上面的编码,但是它不起作用
when i press ctrl+q
, message box should show., i used above coding but its not working
推荐答案
将keyPreview属性设置为true
并且代码应为
Set the keyPreview property to true
and code should be
e.KeyCode.ToString() == "Q"
这篇关于键盘快捷键不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文