Articles in this section
Category / Section

How to custom paint MDI TabPanel to have office 2003 look and feel in WinForms TabbedMDIManager?

1 min read

Customize the MDI tab panel

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

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied