Question

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

Was it helpful?

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

OTHER TIPS

Sames as Ed's, but shorter and more readable ;)

override void OnKeyDown( object sender, KeyEventArgs e )
{
    bool myKeysPressed = (e.KeyCode == Keys.A) &&
                          e.Alt &&
                          e.Shift &&
                          e.Control;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top