Articles in this section
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

 

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