Search
Virtual Keys

Keys in the virtual keyboard are represented by instances of classes derived from Key:

  • RegularKey sends a character or longer string as input to focused control and can display several labels (e.g. for lower and upper case letters). Its Content property specifies the text to send when the key is pressed. the Repeat property lets you send the text several times if set to a value larger than one.
  • SpecialKey represents modifier and function keys. It sends a virtual key code and displays a custom label specified through Content.
  • NumPadKey represents keys on the num-pad. The key code it sends depends on current state of Num lock.
  • ExtendedKey represents a sequence of other keystrokes, listed in its Keys collection property. Pressing such key sends all key codes in the sequence.
  • UnicodeKey represents keyboard keys that send unicode-character codes as input.

You can sends key's content to focused input control programmatically by calling its Send method. Standard modifier, function and num-pad key instances are exposed as static members of the class. For example you can simulate F12 press by calling Key.F12.Send(). To send text, create a RegularKey, set its Content and call Send. The Key class also specifies the position and size of a key within KeyboardLayout. You can set them through Left, Top, Width and Height properties.

When a modifier key such as Shift or Ctrl is pressed, the keyboard does not release it immediately but waits until a regular key is pressed. If AutoReleaseModifierKeys is set to false, modifier keys won't be released automatically, but the user must press them again to turn off their respective mode.

You can check the state of modifier keys by inspecting following properties of VirtualKeyboard:

  • ScrollLocked specifies whether Scroll Lock mode is enabled
  • NumLocked specifies whether Num Lock mode is enabled
  • CapsLocked whether Caps Lock mode is enabled
  • ControlLocked specifies whether the Ctrl key is pressed
  • ShiftLocked specifies whether the Shift key is pressed
  • AltLocked specifies whether the Alt key is pressed
  • AltGrLocked specifies whether the right AltGr key is pressed