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

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-23 01:25:06

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/2277021/wpf-how-do-i-disable-the-systemmenu-shortcut-altspace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!