【发布时间】:2012-09-07 05:10:53
【问题描述】:
我需要将 System.Windows.Forms.Keys 设置为我已分配的字符串。
我正在使用第 3 方 .Net 控件,它允许我将 HotKey 分配给控件,它使用 System.Windows.Forms.Keys 来设置 HotKey。例如:this.systemHotKey1.SetHotKey(System.Windows.Forms.Keys.S); //Assign S as the HotKey
但是,System.Windows.Forms.Keys 不允许我为其分配字符串,我需要为其分配一个实际值。例如,这很好用:
System.Windows.Forms.Keys.S (for the hotkey S on the keyboard).
但我想做这样的事情:
{
string tmpString = "S";
this.systemHotKey1.SetHotKey(System.Windows.Forms.Keys.tmpString); //This does not work
}
有人可以告诉我一种可以将字符串分配给 System.Windows.Forms.Keys 的方法吗?
【问题讨论】: