I know how to obtain which modifier key was pressed in C# but I don't know how I can actually check if any modifier key was pressed. I need to check it in KeyUp
event, is it possible any other way than doing something like if(e.KeyCode != Keys.Control && e.KeyCode != Keys.Alt && ...)
? Thanks.
4
votes
3 Answers
11
votes
3
votes
1
votes
The KeyEventArgs class has properties that you can check. For example, to see if the Alt key was pressed, you can write:
if (e.Alt)
{
// Alt key was pressed
}