.net System.Windows.Forms.Keys 枚举中的“OEM”键是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/582403/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are the "OEM" keys in the System.Windows.Forms.Keys enumeration?
提问by OwenP
A friend was having trouble figuring out how to assign "Ctrl + +" as a shortcut key to a ToolStripMenuItem. I pointed out that the Keys.OemPluskey would work and the display string for the shortcut needed to be set, but the Keysenumeration mystifies me.
一位朋友在弄清楚如何将“Ctrl + +”指定为ToolStripMenuItem. 我指出该Keys.OemPlus键可以工作并且需要设置快捷方式的显示字符串,但Keys枚举使我感到困惑。
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 Keysenumeration?
这些“OEM”密钥是怎么回事?我做了一些搜索,似乎是因为这些键仅在 Win2k 或更高版本中受支持,但这似乎很荒谬,因为我确定人们在 Win2k 之前几十年就一直在使用加号键。为什么没有“OemEquals”?Keys枚举中是否还有其他键完全不存在?
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.OemPlusand checking the Shift modifier key is an OK to tell if Ctrl + = was clicked? Are there other keys that were omitted?
我主要是在寻找为什么这些特殊命名的值存在的答案,但我很想听听关于其他问题的讨论。是否可以安全地假设,由于加号位于我键盘上的等号之上,因此使用Keys.OemPlus和检查 Shift 修饰键可以判断是否单击了 Ctrl + =?是否有其他键被省略?
Note this is nota WPF question, though the System.Windows.Forms.Keysand System.Windows.Input.Keyenumerations look identical (though Keyis named incorrectly according to the Framework Design Guidelines ;))
请注意,这不是WPF 问题,尽管System.Windows.Forms.Keys和System.Windows.Input.Key枚举看起来相同(尽管Key根据框架设计指南命名不正确;))
回答by peterchen
They were introduced with the Windows API, they are not specific to WPF.
它们是与 Windows API 一起引入的,它们并非特定于 WPF。
First, these are KEYcodes, 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.
首先,这些是KEY代码,而不是字符代码:它们标识键盘上的一个键,而不是一个字符——例如,'A' 字符通常是通过在按住 SHIFT 键的同时按下 A 键或激活 CAPS LOCK 来生成的。
The OEM keysare the keys that vary with local keyboards. Where the US keyboard has brackets and braces, german keyboards have umlauts.
该OEM密钥是按键与当地的键盘有所不同。美式键盘带有括号和大括号,而德式键盘带有变音符号。
They are called "OEM" because the Original Equipment Manufacturer (of the keyboard) was responsible for defining their functionality.
它们被称为“OEM”,因为(键盘的)原始设备制造商负责定义它们的功能。
回答by JaredPar
OEM means "Original Equipment Manufacturer" (or something relatively close to that). I think it's an attempt on WPF's part to be somewhat platform neutral. That's just an opinion though.
OEM 的意思是“原始设备制造商”(或相对接近的东西)。我认为这是 WPF 尝试在某种程度上保持平台中立。不过这只是一种意见。

