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

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>