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.
Unfortunately, activation email could not send to your email. Please try again.

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

 

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

Article ID: Published Date: Last Revised Date: Platform: Control:
1243 04/30/2011 05/24/2017 Windows Forms TabControlAdv
Did you find this information helpful?
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
Add Comment
You must log in to leave a comment

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.