private void RegisterHotKey(TextBox txt, Shortcuts.SC_Type Id, KeyEventArgs e) { ShortcutsKey key = new ShortcutsKey(); if (e.KeyCode == Keys.ShiftKey) { return; } if (e.KeyCode == Keys.ControlKey) { return; } if (e.KeyCode == Keys.Alt) { return; } if (e.KeyCode == Keys.Menu) { return; // = Alt } // register hotkey key.key = e; sc.Key_Set(Id, key); txt.Text = key.GetDescriptionString(); }
/// <summary> /// Reads the hot key configuration and setup the UI elements accordingly /// </summary> /// <param name="Id">Configuration type to be read</param> /// <param name="cb">Checkbox to show enable/disable status</param> /// <param name="txt">Textbox to show description string</param> private void LoadHotKey(Shortcuts.SC_Type Id, CheckBox cb, TextBox txt) { ShortcutsKey key = sc.Key_Get(Id); cb.Checked = key.used; txt.Text = key.GetDescriptionString(); }