我正在使用下面的代码作为热键,并想为它使用一个变量,但它不允许我:
private globalKeyboardHook Pvt = new globalKeyboardHook();
private globalKeyboardHook Group = new globalKeyboardHook();
string pvtHotkey = Properties.Settings.Default["pvtHotkey"].ToString();
Pvt.HookedKeys.Add(Keys.F5);
Pvt.KeyDown += new KeyEventHandler(ghk_startPvt);
Group.HookedKeys.Add(Keys.F6);
Group.KeyDown += new KeyEventHandler(ghk_startGroup);
我想这样做:
string pvtHotkey = Properties.Settings.Default["pvtHotkey"].ToString();
Pvt.HookedKeys.Add(pvtHotkey);
Pvt.KeyDown += new KeyEventHandler(ghk_startPvt);
错误“System.Collections.Generic.List.Add(System.Windows.Forms.Keys)”的最佳重载方法匹配有一些无效参数
'System.Collections.Generic.List.Add(System.Windows.Forms.Keys)' 的最佳重载方法匹配有一些无效参数
有任何想法吗?