xtd 0.2.0
Loading...
Searching...
No Matches

◆ key_char() [1/2]

char32 xtd::forms::key_press_event_args::key_char ( ) const
inlinenoexcept

Gets the character corresponding to the key pressed.

Returns
The ASCII character that is composed. For example, if the user presses SHIFT + K, this property returns an uppercase K.
Remarks
Use the key_char property to sample keystrokes at run time and to modify keystrokes under special run-time circumstances. For example, you can use key_char to disable non-numeric keypresses when the user enters a ZIP code, change all alphabetical keypresses to uppercase in a data entry field, or monitor the keyboard or other key input device for specific key combinations.
You can get or set the following keys:
  • a-z, A-Z.
  • CTRL.
  • Punctuation marks.
  • Number keys, both across the top of the keyboard and on the numeric keypad.
  • ENTER.
You cannot get or set the following keys:
  • The TAB key
  • INSERT and DELETE.
  • HOME.
  • END.
  • PAGE UP and PAGE DOWN.
  • F1-F2.
  • CMD and ALT.
  • Arrow keys.
Note
For information about how to detect any of the non-character keys mentioned above, see the key_event_args class.