我在 Visual Studio 2008(框架 3.5)中工作,我正在尝试将快捷方式(例如Shift+
D)添加到 menuStrip(正好添加到 menuStrip 中的 toolStrip),但我不能。我得到错误:
“参数 'value' (65604) 的值对于 Enum 类型无效
Keys
。
参数名称:值”。它只显示Shift. 和,Ctrl没关系Alt。即使我尝试了Ctrl++ ,它也可以工作,但不能只使用和字母。ShiftDShift
The shift key is a modifier key on a keyboard, used to type capital letters and other alternate "upper" characters. It can only be used for shortcuts in conjunction with keys which do not have any alternate usages.
你可以覆盖它。它可以让您Shift与其他键一起使用,例如Ctrl+ Shift+Tab或Ctrl+ tabn 等。我最终遇到了同样的问题,这就是我解决问题的方法:
public class ExtendedTabControl: TabControl
{
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.Tab))
{
// Write custom logic here
return true;
}
if (keyData == (Keys.Control | Keys.Shift | Keys.Tab))
{
// Write custom logic here
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
}
我希望它有帮助