Category / Section
How to customize the size of WinForms TabbedGroupedMDIManager's close button?
1 min read
Customize the size of close button
We can increase the size of the close button of the TabbedGroupMDIManager by deriving it and overriding GetCloseButtonBounds() method.
C#
public class CustomTabbedMDI : TabbedGroupedMDIManager { public CustomTabbedMDI() { } protected override MDITabPanel CreateMDITabPanel() { return new CustomMDITabPanel(this); } } public class CustomMDITabPanel : MDITabPanel { public CustomMDITabPanel(TabbedMDIManager tm) : base(tm) { } protected override Rectangle GetCloseButtonBounds() { Rectangle rect = base.GetCloseButtonBounds(); rect.Width = 20; rect.Height = 20; return rect; } }
VB
Public Class CustomTabbedMDI Inherits TabbedGroupedMDIManager Public Sub New() End Sub Protected Overrides Function CreateMDITabPanel() As MDITabPanel Return New CustomMDITabPanel(Me) End Function End Class Public Class CustomMDITabPanel Inherits MDITabPanel Public Sub New(ByVal tm As TabbedMDIManager) MyBase.New(tm) End Sub Protected Overrides Function GetCloseButtonBounds() As Rectangle Dim rect As Rectangle = MyBase.GetCloseButtonBounds() rect.Width = 20 rect.Height = 20 Return rect End Function End Class