public HotKey(HotKeyWrapper hotKeyWrapper) { CreateHandle(new CreateParams()); if (hotKeyWrapper != null) { RegisterHotKey(Handle, 0, hotKeyWrapper.Modifiers, (uint)hotKeyWrapper.KeyCode); } }
protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); e.SuppressKeyPress = true; switch (e.KeyCode) { case Keys.Alt: case Keys.Control: case Keys.ControlKey: case Keys.Shift: case Keys.ShiftKey: case Keys.Menu: case Keys.LWin: case Keys.RWin: case Keys.HanjaMode: return; } if (e.Alt) { Text += "Alt + "; } if (e.Control) { Text += "Ctrl + "; } if (e.Shift) { Text += "Shift + "; } Text += e.KeyCode.ToString(); Result = new HotKeyWrapper { KeyCode = e.KeyCode, KeyString = Text, Modifiers = 0 }; if (e.Alt) { Result.Modifiers |= (uint)Modifier.Alt; } if (e.Control) { Result.Modifiers |= (uint)Modifier.Control; } if (e.Shift) { Result.Modifiers |= (uint)Modifier.Shift; } editorService.CloseDropDown(); }
public HotKeyWrapperControl(IWindowsFormsEditorService editorService) : base() { this.editorService = editorService; Result = new HotKeyWrapper(); }