Click here to Skip to main content
13,090,426 members (36,323 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi there,

Is there a way to have the TabControl on a WinForm without showing the Tab header?

Kind regards,
Jr
Posted 12-May-09 1:17am
Comments
Member 10331652 12-Oct-13 3:22am
   
;
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try that derived class form TabControl. It simply overrides the DisplayRectangle and adds a ShowTab Property for your new TabControl class. Does it help you ?


<br />public class MyTabControl : TabControl<br />    {<br />        public override Rectangle DisplayRectangle<br />        {<br />            get<br />            {<br />                if (showTabs)<br />                {<br />                    return base.DisplayRectangle;<br />                }<br />                else<br />                {<br />                    return new Rectangle(0, 0, Width, Height);<br />                }<br />            }<br />        }<br /><br />        #region Properties<br />        private bool showTabs = true;<br />        [Category("Apparence"),<br />        Description("Indique si les onglets s'affichent."),<br />        DefaultValue(true)]<br />        public bool ShowTabs<br />        {<br />            get { return showTabs; }<br />            set<br />            {<br />                showTabs = value;<br />                RecreateHandle();<br />            }<br />        }<br />        #endregion<br />    }<br /><br />
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace Marketing_Tool
{
 
    class StackPanel : 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);
        }
    }
}
  Permalink  
  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 10 Apr 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100