WPF: How do I disable the SystemMenu shortcut '

2019-04-10 16:42发布

I have a borderless window and created the chrome but I need to disable the 'Alt+Space' shortcut. Any thoughts?

1条回答
女痞
2楼-- · 2019-04-10 17:08

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);
        }
    }
查看更多
登录 后发表回答