Search code examples
c#winformscombinationskeystroke

Keystroke combinations in c# winforms app


does anyone know how i can setup an event handler so that if the keystrokes Alt + Shift + Ctrl + a letter will do something?


Solution

  • override void OnKeyDown( object sender, KeyEventArgs e )
    {
        bool myKeysPressed = (e.KeyCode == Keys.A) &&
                             ((e.Modifiers & Keys.Alt) == Keys.Alt) &&
                             ((e.Modifiers & Keys.Shift) == Keys.Shift) &&
                             ((e.Modifiers & Keys.Control) == Keys.Control);
    }