开发者

How to use ModifierKeys in a class

开发者 https://www.devze.com 2022-12-27 06:51 出处:网络
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, ho

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消