当用户在文本框中推送this button时,我想做点什么。这就是我试过的:
private void txtInvisible_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Menu)
{
MessageBox.Show("the context menu key was pressed");
}
}
我尝试过Keys.L,并触发了它。也许Keys.Menu可能是错误的键?
答案 0 :(得分:3)
应为Keys.Apps
。
见其他问题:
How can i handle the key that was left to the Right control key
What does WPF call the "Menu" key?
答案 1 :(得分:2)
如前所述。 keys.Apps就是你要找的。 Here您可以找到所有密钥
答案 2 :(得分:2)
只需使用Keys.Apps
键。
private void txtInvisible_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Apps)
{
MessageBox.Show("the context menu key was pressed");
}
}