Loading

TabControl on a WinForm without showing the Tab header?

Hi there,

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

Kind regards,
Jr
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 partial class CustomControl1 : TabControl
    {
        
public CustomControl1()
        {
            InitializeComponent();
        }

        
protected override void OnPaint(PaintEventArgs pe)
        {
            
base.OnPaint(pe);
        }

        
public override Rectangle DisplayRectangle
        {
            
get
            {
                
if (showTabs)
                {
                    
return base.DisplayRectangle;
                }
                
else
                {
                    
return new Rectangle(00, 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
    }

 


 

 

link: http://www.codeproject.com/answers/41153/TabControl-on-a-WinForm-without-showing-the-Tab-he.aspx#answer1

posted @ 2010-01-22 16:00  .net's  阅读(573)  评论(0编辑  收藏  举报