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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I custom paint the tab panel in the TabControlAdv ?

Platform: WinForms |
Control: TabControlAdv |
Published Date: April 30, 2011 |
Last Revised Date: May 24, 2017

 

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

 

Customized TabPanel in TabControlAdv

 

Sample :

PaintCustomPanel_C#

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.

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