Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XtraTabbedMdiManager.CustomDrawHeaderButton Event

Allows you to draw a header button manually.

Namespace: DevExpress.XtraTabbedMdi

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DXCategory("Appearance")]
public event HeaderButtonCustomDrawEventHandler CustomDrawHeaderButton

#Event Data

The CustomDrawHeaderButton event's data class is HeaderButtonCustomDrawEventArgs. The following properties provide information specific to this event:

Property Description
Bounds Gets the rectangle that specifies the bounds of the header button.
Button Gets the button that is being drawn.
Info Provides access to the object that contains information about the button being drawn.
Painter Provides access to the object that performs paint operations. Inherited from ObjectCustomDrawEventArgs.

#Example

The code below shows how to draw a custom background in tab headers and header buttons.

image

using System.Drawing.Drawing2D;

HatchBrush myHatchBrush2 = new HatchBrush(HatchStyle.DiagonalCross, Color.LightGray, Color.AliceBlue);
private void XtraTabbedMdiManager1_CustomDrawHeaderButton(object sender, XtraTab.HeaderButtonCustomDrawEventArgs e) {
    e.Cache.FillRectangle(myHatchBrush2, e.Bounds);
    e.DefaultDraw();
    e.Handled = true;
}

HatchBrush myHatchBrush1 = new HatchBrush(HatchStyle.BackwardDiagonal, Color.LightGray, Color.AliceBlue);
private void XtraTabbedMdiManager1_CustomDrawTabHeader(object sender, XtraTab.TabHeaderCustomDrawEventArgs e) {
    e.Cache.FillRectangle(myHatchBrush1, e.Bounds);
    e.DefaultDrawText();
    e.DefaultDrawImage();
    e.DefaultDrawButtons();
    e.Handled = true;
}
See Also