Is it possible to create a keyboard layout that is identical to the keyboard used?

前端 未结 2 1146
萌比男神i
萌比男神i 2020-12-14 04:59

If I need to generate a keyboard layout for customization to the user that looks like his/her keyboard, how can I do it?

For instance something like this:

2条回答
  •  庸人自扰
    2020-12-14 05:16

    There is no built-in .NET class that contains the keyboard layouts. The keyboard layouts are a function of the Operating System, usually Windows. By the time .NET gets involved, the key pressed has been converted from a hardware event to a software one. If you want to see this in action, find 2 keyboard layouts where a key has moved between them. Setup a dummy app with an event handler on the Key_Down event, and then note that the event args are identical; if you pressed the - key you pressed the - key regardless of where that - key is located.

提交回复
热议问题