简体   繁体   中英

WPF: How do I disable the SystemMenu shortcut 'Alt+Space'?

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

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);
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM