Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

29 Apr 2007

Presenting the MultiPanel

A while ago i was thinking that i would be nice to have a control that exposes multiple designer panels, but only shows one at a time… Somewhat like a TabControl, but without the header.. Anyway, i found out (here) that a TabControl can be tweaked into that behaviour

public class MultiPanel : TabControl
{
	protected override void WndProc(ref Message m)
	{
		if (m.Msg == 0x1328 && !DesignMode)
		{
			m.Result = (IntPtr) 1;
		}
		else
		{
			base.WndProc(ref m);
		}
	}
}

In the designer it appears as following

screenshot of MultiPanel at designtime

screenshot of MultiPanel at designtime

And at runtime it appears as following

screenshot of MultiPanel at designtime

screenshot of MultiPanel at designtime