Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 2:17am
Comments
Member 10331652 at 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 ?


    
public class MyTabControl : TabControl
    {
        public override Rectangle DisplayRectangle
        {
            get
            {
                if (showTabs)
                {
                    return base.DisplayRectangle;
                }
                else
                {
                    return new Rectangle(0, 0, Width, Height);
                }
            }
        }

        #region Properties
        private bool showTabs = true;
        [Category("Apparence"),
        Description("Indique si les onglets s'affichent."),
        DefaultValue(true)]
        public bool ShowTabs
        {
            get { return showTabs; }
            set
            {
                showTabs = value;
                RecreateHandle();
            }
        }
        #endregion
    }

  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
0 OriginalGriff 645
1 Maciej Los 250
2 Richard Deeming 185
3 Suvendu Shekhar Giri 184
4 Abhinav S 151
0 Sergey Alexandrovich Kryukov 9,678
1 OriginalGriff 9,135
2 Peter Leow 5,082
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,606


Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 10 Apr 2012
Copyright © CodeProject, 1999-2015
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