//窗口关闭 private void KeyForm_FormClosing(object sender, FormClosingEventArgs e) { // //注销热键 // WinKey.UnregisterHotKey(Handle, 100); WinKey.UnregisterHotKey(Handle, 101); }
//窗体加载 private void KeyForm_Load(object sender, EventArgs e) { // //注册热键 // WinKey.RegisterHotKey(Handle, 100, WinKey.KeyModifiers.None, Keys.F10);//100是热键ID可以任意设置但不能重复 WinKey.RegisterHotKey(Handle, 101, WinKey.KeyModifiers.None, Keys.F11); }