I'm trying to extend TabControl to be able to hide all tabs. Based on Hans Passant answer (https://stackoverflow.com/a/2207774/965722) I've created code like below:
using System;
using System.Windows.Forms;
class ViewStack : TabControl
{
protected override void WndProc(ref Message m)
{
// Hide tabs by trapping the TCM_ADJUSTRECT message
if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
else base.WndProc(ref m);
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.Tab) || keyData == (Keys.Control | Keys.Shift | Keys.Tab) || keyData == (Keys.Left) || keyData == (Keys.Right))
{
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
}
This way tabs are visible in design mode and hidden in executable. What I need to do is to disable all possible built-in keyboard shortcuts for this control so that changing tab will be available only by code.
For now I have blocked navigation with Ctrl + Tab, Ctrl + Shift + Tab and using Left/Right arrows.
What other shortcuts should I block so that end user won't be able to change tabs on his own (using any key combination that is build in TabControl)?