)
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 custom paint the tab panel in the WinForms TabControlAdv?

Platform: WinForms |
Control: TabControlAdv |
Published Date: April 30, 2011 |
Last Revised Date: January 30, 2020

Customize the tab panel

You should derive TabPanelProperty3D or TabPanelProperty2D depends upon the style of TabControlAdv and override the OnPaintPanelBackground method for this purpose. Then register the CustomTabPanelProperty with the TabRenderer style. After that apply the TabStyle to the TabControlAdv. Please refer the below code snippet which illustrates this:

C#

public Form1()
{
    InitializeComponent();
    TabRendererFactory.RegisterTabType(TabRendererMetro.TabStyleName, typeof(TabRendererMetro), new CustomTabPanelProperty());
    this.tabControlAdv1.TabStyle = typeof(TabRendererMetro);
}
public class CustomTabPanelProperty : Syncfusion.Windows.Forms.Tools.TabPanelProperty3D
{
    public override void OnPaintPanelBackground(ITabControl tabControl, Graphics g, Color bgColor, Rectangle bounds)
    {
       System.Drawing.Drawing2D.LinearGradientBrush lgb = new System.Drawing.Drawing2D.LinearGradientBrush(bounds, Color.Red, Color.GreenYellow, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
       g.FillRectangle(lgb, bounds);
    }
}

VB

Public Sub New()
    InitializeComponent()
    TabRendererFactory.RegisterTabType(TabRendererMetro.TabStyleName, GetType(TabRendererMetro), New CustomTabPanelProperty())
    Me.tabControlAdv1.TabStyle = GetType(TabRendererMetro)
End Sub
Public Class CustomTabPanelProperty
    Inherits Syncfusion.Windows.Forms.Tools.TabPanelProperty3D
    Public Overrides Sub OnPaintPanelBackground(ByVal tabControl As ITabControl, ByVal g As Graphics, ByVal bgColor As Color, ByVal bounds As Rectangle)
       Dim lgb As New System.Drawing.Drawing2D.LinearGradientBrush(bounds, Color.Red, Color.GreenYellow, System.Drawing.Drawing2D.LinearGradientMode.Vertical)
       g.FillRectangle(lgb, bounds)
    End Sub
End Class

Show the customized tab panel in TabControlAdv

Customized TabPanel in TabControlAdv

Samples:

C#: PaintCustomPanel_C#

VB: PaintCustomPanel_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
Comments
Jesús Torres
May 01, 2017
below, what?
Reply
Senthil Kumaran Rajan [Syncfusion]
May 24, 2017

Hi Jesus,

 

Sorry for the inconvenience caused.

 

We have modified the above article to customize the TabPanel in the TabControlAdv. Please find the sample and get back to us if you need further assistance.

 

Regards,

Senthil

Reply

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