Hide Tab Header on C# TabControl

Solution 1:

Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form. It shows the tabs at design time so you can easily switch between them while designing. They are hidden at runtime, use the SelectedTab or SelectedIndex property in your code to switch the page.

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);
  }
}

Solution 2:

tabControl1.Appearance = TabAppearance.FlatButtons;
tabControl1.ItemSize = new Size(0, 1);
tabControl1.SizeMode = TabSizeMode.Fixed;

Solution 3:

Create new UserControl, name it for example TabControlWithoutHeader and change inherited UserControl to TabControl and add some code. Result code should look like:

public partial class TabControlWithoutHeader: TabControl
{
    public TabControlWithoutHeader()
    {
        InitializeComponent();
    }

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

After compile you will have TabControlWithoutHeader control in ToolBox. Drop it on form, in designer you will see headers, but at runtime they'll be hidden. If you want to hide them in designer too, then remove && !DesignMode.

Hope that helps.

http://social.msdn.microsoft.com/Forums/windows/en-US/c290832f-3b84-4200-aa4a-7a5dc4b8b5bb/tabs-in-winform?forum=winforms

Solution 4:

You can replace tabcontrol with a hand made panel that mimic like you want:

class MultiPagePanel : Panel
{
  private int _currentPageIndex;
  public int CurrentPageIndex
  {
    get { return _currentPageIndex; }
    set
    {
      if (value >= 0 && value < Controls.Count)
      {
        Controls[value].BringToFront();
        _currentPageIndex = value;
      }
    }
  }

  public void AddPage(Control page)
  {
    Controls.Add(page);
    page.Dock = DockStyle.Fill;
  }
}

And then add pages and set current visible page:

MultiPagePanel p;

// MyTabPage is a Control derived class that represents one page on your form.
MyTabPage page = new MyTabPage(); 
p.AddPage(page);

p.CurrentPageIndex = 0;

Solution 5:

I was needing this code but in VB.net so I converted it. If someone needs this code in VB.Net there it is

Imports System
Imports System.Windows.Forms

Public Class TablessControl
           Inherits System.Windows.Forms.TabControl

    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        ' Hide tabs by trapping the TCM_ADJUSTRECT message
        If (m.Msg = Convert.ToInt32("0x1328", 16) And Not DesignMode) Then
            m.Result = CType(1, IntPtr)
        Else
            MyBase.WndProc(m)
        End If
    End Sub

End Class

and thanks to @Hans Passant for the answer in C#