public void ChooserPanel_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Escape: CallbackMethod(null); Dispose(); break; case Keys.Down: SelectedControl = controls[Math.Min(controls.IndexOf(selectedControl) + 1, controls.Count - 1)]; break; case Keys.Up: SelectedControl = controls[Math.Max(controls.IndexOf(selectedControl) - 1, 0)]; break; case Keys.Enter: CallbackMethod(SelectedControl); Dispose(); break; default: FilterTextBox.Focus(); SendKeys.Send(e.KeyCode.ToString()); break; } }
private void ChooserPanel_MouseLeave(object sender, EventArgs e) { SelectedControl = null; }