Category / Section
How to customize the tab strip color of auto hide tab in WinForms Docking Manager?
2 mins read
Customization of tab strip color
This can be done by subclassing the docking manager and getting access to the internal AutoHide Tabs. Please refer the below code snippet which illustrates this.
C#
//left foreach (AHTabPage Page in DockingManager1.AutoHiddenTabControlLeft.TabPages) { //'''colore del font Page.TabForeColor = Color.Red; //'''backcolor del tab Page.TabBackColor = Color.SkyBlue; //'''backcolor del contenitore dei tab Page.Parent.BackColor = Color.DarkBlue; } //'''right. foreach (AHTabPage Page in DockingManager1.AutoHiddenTabControlRight.TabPages) { Page.TabForeColor = Color.DarkGoldenrod; Page.TabBackColor = Color.SkyBlue; Page.Parent.BackColor = Color.DarkBlue; } //'''top. foreach (AHTabPage Page in DockingManager1.AutoHiddenTabControlTop.TabPages) { Page.TabForeColor = Color.Yellow; Page.TabBackColor = Color.SkyBlue; Page.Parent.BackColor = Color.DarkBlue; } //'''bottom. foreach (AHTabPage Page in DockingManager1.AutoHiddenTabControlBottom.TabPages) { Page.TabForeColor = Color.Chocolate; Page.TabBackColor = Color.SkyBlue; Page.Parent.BackColor = Color.DarkBlue; } //'''tabbed. if (DockingManager1.IsTabbed(arg.Controls[0])) { DockHost dh = (DockHost)(arg.Controls[0].Parent); DockHostController dhc = (DockHostController)dh.InternalController; DockTabController dtc = (DockTabController)dhc.ParentController; dtc.TabControl.TabPanelBackColor = Color.FromArgb(213, 220, 226); //Accessing the Internal TabControl .Using this, You could set colors same as how you are setting colors for a TabControl. Syncfusion.Windows.Forms.Tools.DockTabControl docktab = (DockTabControl)dtc.TabControl; docktab.ForeColor = Color.DarkBlue; //Setting the color for the selected Tab. docktab.ActiveTabColor = Color.SkyBlue; //Setting the Color for Inactive tab docktab.InactiveTabColor = Color.DarkBlue; }
VB
''''left. For Each Page As AHTabPage In DockingManager1.AutoHiddenTabControlLeft.TabPages ''''colore del font Page.TabForeColor = Color.Red ''''backcolor del tab Page.TabBackColor = Color.SkyBlue ''''backcolor del contenitore dei tab Page.Parent.BackColor = Color.DarkBlue Next ''''right. For Each Page As AHTabPage In DockingManager1.AutoHiddenTabControlRight.TabPages Page.TabForeColor = Color.DarkGoldenrod Page.TabBackColor = Color.SkyBlue Page.Parent.BackColor = Color.DarkBlue Next ''''top. For Each Page As AHTabPage In DockingManager1.AutoHiddenTabControlTop.TabPages Page.TabForeColor = Color.Yellow Page.TabBackColor = Color.SkyBlue Page.Parent.BackColor = Color.DarkBlue Next ''''bottom. For Each Page As AHTabPage In DockingManager1.AutoHiddenTabControlBottom.TabPages Page.TabForeColor = Color.Chocolate Page.TabBackColor = Color.SkyBlue Page.Parent.BackColor = Color.DarkBlue Next ''''tabbed. If DockingManager1.IsTabbed(arg.Controls(0)) Then Dim dh As DockHost = CType(arg.Controls(0).Parent, DockHost) Dim dhc As DockHostController = CType(dh.InternalController, DockHostController) Dim dtc As DockTabController = CType(dhc.ParentController, DockTabController) 'dtc.TabControl.TabStyle = GetType(Syncfusion.Windows.Forms.Tools.OneNoteStyleRenderer) dtc.TabControl.TabPanelBackColor = Color.FromArgb(213, 220, 226) 'Accessing the Internal TabControl .Using this, You could set colors same as how you are setting colors for a TabControl. Dim docktab As Syncfusion.Windows.Forms.Tools.DockTabControl = CType(dtc.TabControl, DockTabControl) docktab.ForeColor = Color.DarkBlue 'Setting the color for the selected Tab. docktab.ActiveTabColor = Color.SkyBlue 'Setting the Color for Inactive tab docktab.InactiveTabColor = Color.DarkBlue End If
Sample: http://help.syncfusion.com/support/samples/kb/Tools.Windows/TDTabColor/TabColor.zip
Reference link: https://help.syncfusion.com/windowsforms/dockingmanager/appearance#customize-documenttdi-window