C# 3.0 - Hide tabPages headers

Asked By Aldo Liaks
14-May-08 05:20 AM
Earn up to 50 extra points for answering this tough question.

Hi guys,

Is this (see below) the best way to hide tabPages headers?

taken from: http://forums.microsoft.com/MSDN/ShowPost.aspx?PageIndex=1&SiteID=1&PageID=1&PostID=2501509

Thanks,

Aldo.

Add a new class to your project, paste the code shown below and build the project.  You can now drop the control from the top of the toolbox onto your form.  At design time, the control looks like a regular TabControl.  At run-time, you only see the pages.  Use the SelectedIndex property to step through the pages.

Code Block

using System;

using System.Windows.Forms;

 

public class WizardPages : 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);

    }

         }

Create New Account