Keys enum missing keys

  • Thread starter Thread starter John
  • Start date Start date
John said:
where are the following key codes in System.Windows.Forms.Keys
: ; * = . , ' "

thanks

Hi John,

There are oem keys and will vary from keyboard to keyboard. To find out
what those keys are on your keyboard trap the KeyDown event and output the
received keys as you type the keyboard.

For comparison on my keyboard (Norwegian) those map to
OemPeriod, Oemcomma, OemQuestion, D0, OemPeriod, Oemcomma, OemQuestion, D2

if I switch to English keyboard they will map to
Oem1, Oem1, D8, OemPlus, OemComma, OemPeriod, Oem7, Oem7

You may use the Keys enumeration to map keyboard key behaviour, but you
shouldn't map the keys to specific characters as that will depend on the
keyboard layout.
 
Morten said:
There are oem keys and will vary from keyboard to keyboard.

Hi Morten,

Right, thanks. I was in state of confusion converting some code from C++
that needs to parse characters out of a string. The seeming ubiquitous
C# stream interface that always returns Int32 (even the
MemoryStream.ReadByte() converts to Int32) confused me to the point
where I momentarily thought that KeyCode enumerated character values,
not, uh, KeyCodes :)

Anyways, I have decided to use the BinaryStream since it seems to be the
only one that allows you to specify an Encoding. Problem is the C++ code
relies on the putback() function, the MemoryStream supports this but the
convolution of it converting to Int32 makes it better to re-implement
using Peek() with the BinaryStream. Also, I like the BinaryStream
because I can easily refactor to another Encoding.

Thanks again.
 
Back
Top