1
votes

is there a way to detect all the key pressed in keydown event of the form? For example im currently pressing CRTL + Alt + A can i get all the keys in keydown event? i need to get all the keys to create my own hot keys in my currently developing application

2
Hi i didnt get all the pressed key by applying this to my project any idea?bRaNdOn
you want to know what keys are presseD?Sajeetharan
Yes is there a way to do it?bRaNdOn

2 Answers

1
votes

If you want to find which keys are pressed, you could do this,

     if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt) // Is Alt key pressed
        {
            if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.A))
            {
                MessageBox.Show("Key pressed"); 
            }
       }
1
votes

You can check for all keys in event arguments

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Alt && e.Control && e.KeyCode == Keys.A)
    {
        //do something
    }
}