Click here to Skip to main content
14,698,687 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am Using TabControl in My Project, i want Hide TabControl Headers only not in Whole Tab,

any Solution is there
Posted
Updated 3-Sep-20 6:47am
Comments
Meysam Tolouee 1-Jul-13 17:52pm
   
You must explain more about your issue to gain the best solution.

Hi,

I use the first answer, plus the deletion of the tab text.

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

foreach (TabPage tab in tabControl1.TabPages)
{
    tab.Text = "";
}


After that i use a treeview to select each tab, like a "configuration form style".
   
Comments
MrGenie 27-Sep-16 5:44am
   
I don't think this is a nice solution as you'll get a big border around your control.
Member 14131805 24-Oct-20 10:43am
   
very good idea!!!! thank very much!!!
I Finded the Solutions

Solution is

Maintab.Appearance = TabAppearance.FlatButtons; Maintab.ItemSize = new Size(0, 1); Maintab.SizeMode = TabSizeMode.Fixed;
   
Comments
Ajeet Kumar 9-Oct-19 7:01am
   
Have also tried on design time. but using code is a good idea.
MCS_Erik 11-Feb-20 4:41am
   
Just wanna say 'Thank you!'. Works great!
If you are using Windows Forms, the only way to hide a single tab page is to remove it from the TabPages collection of the Tabs control. There is no .Visible attribute that works on Tab Pages. If you are using WPF I think there are ways to do it, but I don't know what framework you are using.
   
Comments
Meysam Tolouee 1-Jul-13 17:50pm
   
I think you didn't read the question carefully. vijay79041384 didn't ask a solution for hiding a TabPage, but the TabPage's header. did S/He?
C#

private void TabItemControl_MouseEnter(object sender, MouseEventArgs e) {
 if (this.TabItemControl.IsSelected == false) { this.TabItemControl.Opacity = 100;}
}

private void TabItemControl_MouseLeave(object sender, MouseEventArgs e) {
 if (this.TabItemControl.IsSelected == false) { this.TabItemControl.Opacity = 0;}
}

private void TabAllControl_SelectionChanged(object sender, SelectionChangedEventArgs e) {
 if (this.TabItemControl.IsSelected == false) { this.TabItemControl.Opacity = 0;}
}
   
//Hide TabPage and Remove the Header:

this.tabPage1.Hide();
this.tabPage3.Hide();
this.tabPage5.Hide();
tabControl1.TabPages.Remove(tabPage1);
tabControl1.TabPages.Remove(tabPage3);
tabControl1.TabPages.Remove(tabPage5);
//Show TabPage and Visible the Header:

tabControl1.TabPages.Insert(0,tabPage1);
tabControl1.TabPages.Insert(2, tabPage3);
tabControl1.TabPages.Insert(4, tabPage5);
this.tabPage1.Show();
this.tabPage3.Show();
this.tabPage5.Show();
tabControl1.SelectedTab = tabPage1;
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900