To disable Tab-key in menus you need to handle PreviewKeyDown
and set e.IsInputKey
, this seems to prevent selection logic from running.
There is a problem with sub-menus, because each drop-down has its own event, which you need to handle.
If menu is created, then you can find all sub-menus recusively and subscribe each, something like this:
public Form1(){ InitializeComponent(); DisableTabKeyRecursive(contextMenuStrip1); void DisableTabKeyRecursive(ToolStripDropDown menu) { menu.PreviewKeyDown += (s, e) => { if (e.KeyCode == Keys.Tab) e.IsInputKey = true; }; foreach (ToolStripMenuItem item in menu.Items) if (item.HasDropDown) DisableTabKeyRecursive(item.DropDown); }}