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

 

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

Article ID: Published Date: Last Revised Date: Platform: Control:
1321 04/30/2011 07/10/2014 Windows Forms TabbedMDIManager
Tags:
Did you find this information helpful?
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.