Articles in this section
Category / Section

How to set the color and font style to the active tab in the docked tab window in WinForms Docking Manager?

1 min read

Color and Font style to active tab

If the docking windows are grouped together as the DockTab control, then it will internally initiate the DockTabController as the Parent controller of the DockHostcontrol. By this DockTabController we can access the Tabbed group docking windows.

The above procedures are implemented as the following code:

C#

private void dockingManager1_DockStateChanged(object sender, System.EventArgs e)
{
    Syncfusion.Windows.Forms.Tools.DockHost dhost = this.panel1.Parent as  Syncfusion.Windows.Forms.Tools.DockHost; //panel1 is a docked control and currently in tabbed style
    Syncfusion.Windows.Forms.Tools.DockHostController dhc = dhost.InternalController as Syncfusion.Windows.Forms.Tools.DockHostController;
    if(dhc.ParentController is Syncfusion.Windows.Forms.Tools.DockTabController)
    {
       //Accessing the Internal Tab
       Syncfusion.Windows.Forms.Tools.DockTabControl docktab = (dhc.ParentController as Syncfusion.Windows.Forms.Tools.DockTabController).TabControl;
       //Setting the Font style and color for the selected Tab.
       docktab.ActiveTabFont = new System.Drawing.Font("TimesNewRoman",10,FontStyle.Bold);
       docktab.ActiveTabColor= System.Drawing.Color.FromArgb(196,214,233);
       //Setting the Font Style for Inactive tab
       docktab.InactiveTabColor= System.Drawing.Color.FromArgb(102,110,152);
       docktab.Font= new System.Drawing.Font("Arial",10);
    }
}

 

VB

Private Sub dockingManager1_DockStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dockingManager1.NewDockStateEndLoad
    Dim dhost As Syncfusion.Windows.Forms.Tools.DockHost = CType(IIf(TypeOf Me.panel1.Parent Is Syncfusion.Windows.Forms.Tools.DockHost, Me.panel1.Parent, Nothing),  Syncfusion.Windows.Forms.Tools.DockHost) 'panel1 is a docked control and currently in tabbed style
    Dim dhc As Syncfusion.Windows.Forms.Tools.DockHostController = CType(IIf(TypeOf dhost.InternalController Is Syncfusion.Windows.Forms.Tools.DockHostController, dhost.InternalController, Nothing), Syncfusion.Windows.Forms.Tools.DockHostController)
    If TypeOf dhc.ParentController Is Syncfusion.Windows.Forms.Tools.DockTabController Then
       'Accessing the Internal Tab
       Dim docktab As Syncfusion.Windows.Forms.Tools.DockTabControl = CType(IIf(TypeOf  dhc.ParentController Is Syncfusion.Windows.Forms.Tools.DockTabController, dhc.ParentController,  Nothing), Syncfusion.Windows.Forms.Tools.DockTabController).TabControl
       'Setting the Font style and color for the selected Tab.
       docktab.ActiveTabFont = New System.Drawing.Font("TimesNewRoman",10,FontStyle.Bold)
       docktab.ActiveTabColor= System.Drawing.Color.FromArgb(196,214,233)
       'Setting the Font Style for Inactive tab
       docktab.InactiveTabColor= System.Drawing.Color.FromArgb(102,110,152)
       docktab.Font= New System.Drawing.Font("Arial",10)
    End If
End Sub

 

Reference link: https://help.syncfusion.com/windowsforms/dockingmanager/appearance#customize-documenttdi-window

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied