tags:

views:

20

answers:

2

Hi,

I need to access "ModifierKeys" from a class, not from a form (I have a reference to that form, but frm.Modifierkeys is not allowed from the class). Is that possible, and if yes, how?

Thanks!

A: 

If you can pass KeyEventArgs to your class (from a KeyUp or KeyDown event handler), you have access to the KeyEventArgs.Modifiers property.

Oded
Thanks, that might be handy too :)
Jiri
+2  A: 

ModifierKeys is static so you should be able to just call

Control.ModifierKeys

Otherwise you can PInvoke the GetKeyState method.

ho1
Thanks! Works great!
Jiri