wpf阻止鍵盤快捷鍵alt+space,alt+F4
阿新 • • 發佈:2018-03-23
HR mod oar ace .com nbsp rri inpu http 原文: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);
}
}
wpf阻止鍵盤快捷鍵alt+space,alt+F4