// Add keyboard shortcuts to search. private void ComboBoxSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Tab) // Move focus to tweaks. { DataGridViewTweaks.Focus(); e.SuppressKeyPress = true; } else if (e.Control && e.KeyCode == Keys.Space) // Show category dropdown. { ComboBoxSearch.DroppedDown = true; e.SuppressKeyPress = true; } }
// Add keyboard shortcuts to tweaks. private void DataGridViewTweaks_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Space: case Keys.Enter: // Toggle tweak. ((Tweak)DataGridViewTweaks.CurrentRow.DataBoundItem).Toggle(); DataGridViewTweaks.Refresh(); e.Handled = true; break; case Keys.Tab: // Move focus to search. ComboBoxSearch.Select(); e.Handled = true; break; } }