How to customize the close button in TabbedGroupMDIManager
3 Sep 20202 minutes to read
This can be achieved by deriving TabbedGroupMDIManager class and overriding GetCloseButtonBounds method as follows.
public class CustomTabbedMDI : TabbedGroupedMDIManager
{
public CustomTabbedMDI() { }
protected override MDITabPanel CreateMDITabPanel()
{
return new CustomMDITabPanel(this);
}
}
public class CustomMDITabPanel : MDITabPanel
{
public CustomMDITabPanel(TabbedMDIManager tabbedMDIManager)
: base(tabbedMDIManager)
{ }
protected override Rectangle GetCloseButtonBounds()
{
Rectangle rect = base.GetCloseButtonBounds();
rect.Y = 4; rect.Width = 15; rect.Height = 15;
return rect;
}
}
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 tabbedMDIManager As TabbedMDIManager)
MyBase.New(tabbedMDIManager)
End Sub
Protected Overrides Function GetCloseButtonBounds() As Rectangle
Dim rect As Rectangle = MyBase.GetCloseButtonBounds()
rect.Y = 4
rect.Width = 15
rect.Height = 15
Return rect
End Function
End Class