c# - How to detect the currently pressed key? -


In

, you know, at any point in time, thanks to the current condition of the cursor class.

The same thing is not available for the keyboard. Is it possible to know that, for example, the shift key is pressed?

Is it absolutely necessary to track every keyboard notification (keydown and key-up event)?

  if ((Control.ModifierKeys and Keys.Shift)! = 0)  

This will also be true if Ctrl + Shift is below if you want to check that it is shifted alone, then

  If (Control.ModifierKeys == Keys.Shift)  

If you are in a class that receives control (like a form) You can remove the control.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -