Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the "OEM" keys in the System.Windows.Forms.Keys enumeration?

Tags:

A friend was having trouble figuring out how to assign "Ctrl + +" as a shortcut key to a ToolStripMenuItem. I pointed out that the Keys.OemPlus key would work and the display string for the shortcut needed to be set, but the Keys enumeration mystifies me.

What's the deal with these "OEM" keys? I've done a little searching and it seems like it's because the keys are only supported in Win2k or later, but that seems ridiculous as I'm certain people have been using the plus key decades before Win2k. Why's there no "OemEquals"? Are there other keys that are completely absent from the Keys enumeration?

I'm mostly looking for an answer to why these special-named values exist, but I'd love to hear discussion about the other questions. Is it safe to assume that since the plus sign is on top of the equals sign on my keyboard that using Keys.OemPlus and checking the Shift modifier key is an OK to tell if Ctrl + = was clicked? Are there other keys that were omitted?

Note this is not a WPF question, though the System.Windows.Forms.Keys and System.Windows.Input.Key enumerations look identical (though Key is named incorrectly according to the Framework Design Guidelines ;))

like image 248
OwenP Avatar asked Feb 24 '09 16:02

OwenP


People also ask

What are OEM keyboard keys?

The OEM keys are the keys that vary with local keyboards. Where the US keyboard has brackets and braces, german keyboards have umlauts. They are called "OEM" because the Original Equipment Manufacturer (of the keyboard) was responsible for defining their functionality.

What is key enumeration?

List of enumerated values for processing keyboard input with Forms controls.

What is key D0?

The D key. D0. The 0 (zero) key. D1. The 1 (one) key.


1 Answers

They were introduced with the Windows API, they are not specific to WPF.

First, these are KEY codes, not character codes: they identify a key on your keyboard, not a character - e.g. the 'A' character is usually generated by pressing the A key while holding down a SHIFT key or having CAPS LOCK active.

The OEM keys are the keys that vary with local keyboards. Where the US keyboard has brackets and braces, german keyboards have umlauts.

They are called "OEM" because the Original Equipment Manufacturer (of the keyboard) was responsible for defining their functionality.

like image 75
peterchen Avatar answered Oct 08 '22 21:10

peterchen