System.Windows.Forms.Keys - lowercase or uppercase?

I was looking for the answer to this question, but I can not find anything. Does anyone know if you can define a shell letter in Keys ?

For instance:

 if (System.Windows.Forms.Keys.A.ToString() == "A") { // Upper or Lower? } 

Thanks.

+4
source share
3 answers

The case is missing; it is a physical key on the keyboard. Do you see “a” and “A” on the keyboard?

You can check if the Shift key is pressed.

+6
source

System.Windows.Forms.Keys.A represents the physical key A on the keyboard. This is not the case. So your question is not meaningful.

If you want to check if the user contains a Shift key on the keyboard, also System.Windows.Forms.Keys.Shift .

+3
source

There is no simple mapping between keys and characters. Keyboard layouts can work in different ways. One example is dead keys. And once you get into IME, it gets even harder. Do not try to duplicate the keyboard layout manually in your application.

If you want which character the user entered, process WM_CHAR , not WM_KEY_DOWN/UP . It displays as a Control.KeyPress event in winforms.

+2
source

Source: https://habr.com/ru/post/1390476/


All Articles