如何在此处应用从文本框中输入的键
我已经使用 RegisterHotkey() 很长时间了,但我希望它是可自定义的,并且在文本框中输入的键可以应用到 RegisterHotkey 中,这样我就可以在应用程序本身中对其进行自定义。
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
m_hotkey = e.KeyData;
textBox1.Text = new KeysConverter().ConvertToString(m_hotkey);
}
至
private void RegisterHotKeys()
{
int id = 0;
RegisterHotKey(this.Handle, id, (int)KeyModifier.Control, Keys.NumPad0.GetHashCode());
id++;
}
例如 Ctrl + 0
m_hotkey = 0 而修饰符 will = 控制