wpf屏蔽快捷键alt+space,alt+F4

   /// <summary>
        /// 阻止 alt+f4和alt+space 按键
        /// </summary>
        /// <param name="e"></param>
        protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e)
        {
            if (Keyboard.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.Space)
            {
                e.Handled = true;
            }
            else if (Keyboard.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.F4)
            {
                e.Handled = true;
            }
            else
            {
                base.OnKeyDown(e);
            }
        }

posted @ 2017-02-09 16:45  灰主流  阅读(919)  评论(0编辑  收藏  举报