WPF:如何禁用SystemMenu快捷键"Alt + Space"? [英] WPF: How do I disable the SystemMenu shortcut 'Alt+Space'?
本文介绍了WPF:如何禁用SystemMenu快捷键"Alt + Space"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个无边界的窗口并创建了镶边,但是我需要禁用"Alt + Space"快捷方式.有什么想法吗?
I have a borderless window and created the chrome but I need to disable the 'Alt+Space' shortcut. Any thoughts?
推荐答案
我对WPF不太满意,但是经过一番混乱之后,这似乎是正确的.只需将其扔到您的Window代码后面即可:
I'm not very good with WPF, but after some messing around, this seems to be on the right track. Just throw it in your Window code-behind:
protected override void OnKeyDown(KeyEventArgs e)
{
if (Keyboard.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.Space)
{
e.Handled = true;
}
else
{
base.OnKeyDown(e);
}
}
这篇关于WPF:如何禁用SystemMenu快捷键"Alt + Space"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文