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 to custom paint MDI TabPanel to have office 2003 look and feel?

Platform: WinForms |
Control: TabbedMDIManager |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014

 

Derive CustomTabPanelProperty from the TabPanelProperty (TabPanelProperty3D in this case) for the appropriate TabStyle and then register the TabType with the TabRendererFactory. Please refer the below code snippet which illustrates this:

C#

TabRendererFactory.RegisterTabType(TabRendererWhidbey.TabStyleName, typeof(TabRendererWhidbey), new CustomTabPanelProperty());

void tb_TabControlAdded(object sender, TabbedMDITabControlEventArgs args)

{

args.TabControl.TabStyle = typeof(TabRendererWhidbey);

}

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.FromArgb(235, 235, 244), Color.FromArgb(186, 185, 206), System.Drawing.Drawing2D.LinearGradientMode.Vertical);

g.FillRectangle(lgb, bounds);

}

}

VB

Syncfusion.Windows.Forms.Tools.TabRendererFactory.RegisterTabType(Syncfusion.Windows.Forms.Tools.TabRendererWhidbey.TabStyleName, GetType(Syncfusion.Windows.Forms.Tools.TabRendererWhidbey), New CustomTabPanelProperty())

Private Sub tb_TabControlAdded(ByVal sender As Object, ByVal args As TabbedMDITabControlEventArgs)

args.TabControl.TabStyle = GetType(TabRendererWhidbey)

End Sub

Public Class CustomTabPanelProperty : Inherits Syncfusion.Windows.Forms.Tools.TabPanelProperty3D

Public Overrides Sub OnPaintPanelBackground(ByVal tabControl As Syncfusion.Windows.Forms.Tools.ITabControl, ByVal g As Graphics, ByVal bgColor As Color, ByVal bounds As Rectangle)

Dim lgb As System.Drawing.Drawing2D.LinearGradientBrush = New System.Drawing.Drawing2D.LinearGradientBrush(bounds, Color.FromArgb(235, 235, 244), Color.FromArgb(186, 185, 206), System.Drawing.Drawing2D.LinearGradientMode.Vertical)

g.FillRectangle(lgb, Bounds)

End Sub

End Class

Sample:

http://websamples.syncfusion.com/samples/KB/Tools.Windows/TOffice2003/main.htm

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.

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