Articles in this section
Category / Section

How to change the TabStyle of the WinForms Docking Manager?

1 min read

Applying the Tabstyle

There is no straight method or property to achieve this. but this can be achieved by getting the DockTabControl object from DockHostController and apply the TabStyle for the DockTabControl. Please refer the below code snippet which illustrates this:

C#

private void button1_Click(object sender, EventArgs e)
{
   Syncfusion.Windows.Forms.Tools.DockHost dhost = this.panel1.Parent as  Syncfusion.Windows.Forms.Tools.DockHost;
   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 DockTabControl from the DockHostController
      Syncfusion.Windows.Forms.Tools.DockTabControl docktab = (dhc.ParentController as
Syncfusion.Windows.Forms.Tools.DockTabController).TabControl;
      //Applying the TabStyle to the DockTabControl
      docktab.TabStyle = typeof(Syncfusion.Windows.Forms.Tools.OneNoteStyleRenderer);
   }
}

 

VB

Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
    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)
    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 DockTabControl from the DockHostController
       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
       'Applying the TabStyle to the DockTabControl
       docktab.TabStyle = GetType(Syncfusion.Windows.Forms.Tools.OneNoteStyleRenderer)
    End If
End Sub

 

Sample: http://help.syncfusion.com/support/samples/KB/Tools.Windows/TDTabStyle/TabStyle.zip

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