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

This entry was posted on Sunday, April 29th, 2007 at 11:51 and is filed under C#, Windows Forms. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.