Skip to main content
A newer version of this page is available. .

TabbedView.CustomDrawHeaderButton Event

Allows you to draw a header button manually.

Namespace: DevExpress.XtraBars.Docking2010.Views.Tabbed

Assembly: DevExpress.XtraBars.v20.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

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.
Cache Provides access to the drawing surface and a cache of pens, fonts, and brushes. Inherited from ObjectCustomDrawEventArgs.
Graphics Provides access to the drawing surface. Inherited from ObjectCustomDrawEventArgs.
Handled Gets or sets whether the event is handled and prevents the default draw operation from being performed. Inherited from ObjectCustomDrawEventArgs.
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.

The event data class exposes the following methods:

Method Description
DefaultDraw() Draws the visual element according to the default algorithm.

Example

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

using System.Drawing.Drawing2D;

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