private void txtHotKey_PreviewHotKey(object sender, PreviewHotKeyEventArgs e)
 {
     if (MainForm.Instance.KeyMap.ContainsKey(e.HotKey))
     {
         e.Cancel = true;
     }
 }
 protected virtual void OnPreviewHotKey(PreviewHotKeyEventArgs e)
 {
     EventHandler<PreviewHotKeyEventArgs> handler = base.Events[EventPreviewHotKey] as EventHandler<PreviewHotKeyEventArgs>;
     if (handler != null)
     {
         handler(this, e);
     }
 }
 private void UpdateHotKey(Keys priorHotKey, Keys newHotKey)
 {
     if (!IsValidKeyCode(newHotKey & Keys.KeyCode))
     {
         newHotKey = Keys.None;
     }
     PreviewHotKeyEventArgs e = new PreviewHotKeyEventArgs(newHotKey) {
         Cancel = (newHotKey == Keys.None) ? true : IsSimpleKeyData(newHotKey)
     };
     this.OnPreviewHotKey(e);
     this.FHotKey = (IsValidKeyCode(e.HotKey & Keys.KeyCode) && !e.Cancel) ? e.HotKey : Keys.None;
     this.Text = this.KeyDataToString(ref this.FHotKey);
     base.SelectionStart = this.Text.Length;
     if (this.FHotKey != priorHotKey)
     {
         this.OnHotKeyChanged(EventArgs.Empty);
     }
 }
 private void txtShortcut_PreviewHotKey(object sender, PreviewHotKeyEventArgs e)
 {
     switch (e.HotKey)
     {
         case Keys.Insert:
         case Keys.Delete:
         case Keys.Space:
         case Keys.Back:
         case Keys.Return:
             e.Cancel = false;
             break;
     }
 }