How to use ModifierKeys in a class
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 po开发者_如何学JAVAssible, and if yes, how?
Thanks!
ModifierKeys is static so you should be able to just call
Control.ModifierKeys
Otherwise you can PInvoke the GetKeyState method.
If you can pass KeyEventArgs
to your class (from a KeyUp
or KeyDown
event handler), you have access to the KeyEventArgs.Modifiers
property.
精彩评论