)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the navigation button size in WinForms TabControlAdv?

Platform: WinForms |
Control: TabControlAdv |
Published Date: May 15, 2018 |
Last Revised Date: January 30, 2020 |
.NET Framework: 4

Change tab navigation button size

TabControlAdv has the collection of TabPrimitives which used to display the navigation buttons. We have maintained the navigation buttons size internally. This navigation button size can be customized using reflection. The following code demonstrates the same.

C#

//Add reflection namespace
using System.Reflection;
 
//TabControlAdv Item size
this.tabControlAdv1.ItemSize = new Size(this.tabControlAdv1.ItemSize.Width, 50);
//Set the TabPrimitive size
foreach (TabPrimitive item in this.tabControlAdv1.TabPrimitivesHost.TabPrimitives)
{
  var obj = item;
  FieldInfo fi = obj.GetType().GetField("m_szSize", BindingFlags.NonPublic | BindingFlags.Instance);
  //Set the size
  fi.SetValue(obj, new Size(50, 50));
}
 
//Custom Button Image
this.tabControlAdv1.TabPrimitivesHost.TabPrimitives.Add(new TabPrimitive(TabPrimitiveType.NextPage, Properties.Resources.loadscreen, Color.FromArgb(64,64,64), true, 1, "TabPrimitive0", ""));
this.tabControlAdv1.TabPrimitivesHost.TabPrimitives.Add(new TabPrimitive(TabPrimitiveType.PreviousTab, Properties.Resources.dp4, Color.FromArgb(64, 64, 64), true, 1, "TabPrimitive1", ""));
this.tabControlAdv1.TabPrimitivesHost.TabPrimitives.Add(new TabPrimitive(TabPrimitiveType.DropDown, Properties.Resources.dp2, Color.FromArgb(64, 64, 64), true, 1, "TabPrimitive2", ""));
this.tabControlAdv1.TabPrimitivesHost.TabPrimitives.Add(new TabPrimitive(TabPrimitiveType.FirstTab, Properties.Resources.dp3, Color.FromArgb(64, 64, 64), true, 1, "TabPrimitive3", ""));
 

VB

‘Add reflection namespace
Imports System.Reflection
 
'TabControlAdv Item size
Me.tabControlAdv1.ItemSize = New Size(Me.tabControlAdv1.ItemSize.Width, 50)
'Set the TabPrimitive Buttons size
For Each item As TabPrimitive In Me.tabControlAdv1.TabPrimitivesHost.TabPrimitives
  Dim obj = item
  Dim fi As FieldInfo = obj.GetType().GetField("m_szSize", BindingFlags.NonPublic Or BindingFlags.Instance)
  fi.SetValue(obj, New Size(50, 50))
Next item
 
'Custom Button Image
Me.tabControlAdv1.TabPrimitivesHost.TabPrimitives.Add(New TabPrimitive (TabPrimitiveType.NextPage, My. Resources.loadscreen, Color.FromArgb(64,64,64), True, 1, "TabPrimitive0", ""))
Me.tabControlAdv1.TabPrimitivesHost.TabPrimitives.Add(New TabPrimitive (TabPrimitiveType.PreviousTab, My. Resources.dp4, Color.FromArgb(64, 64, 64), True, 1, "TabPrimitive1", ""))
Me.tabControlAdv1.TabPrimitivesHost.TabPrimitives.Add(New TabPrimitive (TabPrimitiveType.DropDown, My. Resources.dp2, Color.FromArgb(64, 64, 64), True, 1, "TabPrimitive2", ""))
Me.tabControlAdv1.TabPrimitivesHost.TabPrimitives.Add(New TabPrimitive (TabPrimitiveType.FirstTab, My. Resources.dp3, Color.FromArgb(64, 64, 64), True, 1, "TabPrimitive3", ""))

Screenshot

Change the navigation button size in TabControlAdv

Samples:

C#:  TabControlAdvExample

VB:  TabControlAdvExample

Reference link: https://help.syncfusion.com/windowsforms/tabcontrol/tab-navigation

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon