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.
Syncfusion Feedback

How to customize the close button of the individual MDI child in TabbedGroupedMDIManager?

 

We can customize the size of the close button of the individual MDI child in TabbedGroupedMDIManager by deriving it's tab style renderer and overriding GetCloseButtonBounds() method

C#

//Rendering TabRendererOffice2007 since the TabbedGroupedMDIManager's //tabstyle is set as TabRendererOffice2007.

public class TabRendererMSOffice2007 : TabRendererOffice2007

{

static TabUIDefaultProperties tabPanelPropertyExtender;

// Exposes the default appearance properties to the tab panel renderer.

public static new TabUIDefaultProperties TabPanelPropertyExtender

{

get { return tabPanelPropertyExtender; }

}

// Specifies the name by which this renderer will be identified.

public static new string TabStyleName

{

get { return "MSOffice2007"; }

}

static TabRendererMSOffice2007()

{

tabPanelPropertyExtender = new TabUIDefaultProperties();

TabRendererFactory.RegisterTabType(TabStyleName, typeof(TabRendererMSOffice2007), TabPanelPropertyExtender);

}

public TabRendererMSOffice2007(ITabControl parent, ITabPanelRenderer panelRenderer) : base(parent, panelRenderer)

{ }

protected override RectangleF GetCloseButtonBounds(DrawTabEventArgs drawItemInfo)

{

// Get the close button bounds and change the size, as needed.

RectangleF rect = base.GetCloseButtonBounds(drawItemInfo);

rect.Width = 10;

rect.Height = 10;

return rect;

}

VB

'Rendering TabRendererOffice2007 since the TabbedGroupedMDIManager's 'tabstyle is set as TabRendererOffice2007.

Public Class TabRendererMSOffice2007

Inherits TabRendererOffice2007

Private Shared tabPanelPropertyExtender_Renamed As TabUIDefaultProperties

' Exposes the default appearance properties to the tab panel renderer.

Public Shared Shadows ReadOnly Property TabPanelPropertyExtender() As TabUIDefaultProperties

Get

Return tabPanelPropertyExtender_Renamed

End Get

End Property

' Specifies the name by which this renderer will be identified.

Public Shared Shadows ReadOnly Property TabStyleName() As String

Get

Return "MSOffice2007"

End Get

End Property

Shared Sub New()

tabPanelPropertyExtender_Renamed = New TabUIDefaultProperties()

TabRendererFactory.RegisterTabType(TabStyleName, GetType(TabRendererMSOffice2007), TabPanelPropertyExtender)

End Sub

Public Sub New(ByVal parent As ITabControl, ByVal panelRenderer As ITabPanelRenderer)

MyBase.New(parent, panelRenderer)

End Sub

Protected Overrides Function GetCloseButtonBounds(ByVal drawItemInfo As DrawTabEventArgs) As RectangleF

' Get the close button bounds and change the size, as needed.

Dim rect As RectangleF = MyBase.GetCloseButtonBounds(drawItemInfo)

rect.Width = 10

rect.Height = 10

Return rect

End Function

End Class

Sample :

http://help.syncfusion.com/support/uploads/tools.windows/kb/kb_individualtabclosebutton/ToolS_WF_KB_IndividualTabClosebtn.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
1833 04/30/2011 07/10/2014 Windows Forms TabbedGroupedMDIManager
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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