How to handle folded controls in .NET Winforms?

I have a form that will contain several panel controls on top of each other, each of which will be displayed / hidden based on the other selected options in the form. This was a real pain to manage in the form designer, because the panels do not behave like a full TabControl. However, it doesn't seem like you can use TabControl without tabs. What is the best way to handle this? Is there a control like TabControl, but no tabs?

+4
source share
1 answer

You can hide tabs that are very convenient in the designer. Add a new class to the project and paste this code:

using System;
using System.Windows.Forms;

public class TablessControl : 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);
  }
}
+6
source

All Articles