Skip to main content

XtraTabControl.CustomDrawTabHeader Event

Allows you to custom paint tabs.

Namespace: DevExpress.XtraTab

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

[DXCategory("Appearance")]
public event TabHeaderCustomDrawEventHandler CustomDrawTabHeader

Event Data

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

Property Description
Bounds Gets the rectangle that specifies the bounds of the tab header.
Cache Provides access to the drawing surface and a cache of pens, fonts, and brushes.
ControlInfo Gets an object that contains information about the tab being drawn.
Graphics Provides access to the drawing surface.
Handled Gets or sets whether the event is handled and prevents the default draw operation from being performed.
Painter Provides access to the object that performs paint operations.
TabHeaderInfo Provides access to the object that contains information about the page being drawn.
TabHeaderRowInfo Provides access to the object that contains information about the row being drawn.

The event data class exposes the following methods:

Method Description
DefaultDraw() Draws the visual element according to the default algorithm.
DefaultDrawBackground() Draws the visual element’s background according to the default algorithm.
DefaultDrawButtons() Draws the visual element’s buttons according to the default algorithm.
DefaultDrawImage() Draws the visual element’s icon according to the default algorithm.
DefaultDrawText() Draws the visual element’s text according to the default algorithm.
DrawHtml(HtmlTemplate, DxHtmlPainterContext, Action<DxHtmlPainterArgs>) Paints the required HTML template inside an element that raised this event. The context parameter allows you to assign an object that transfers mouse events to template elements.
DrawHtml(HtmlTemplate, Action<DxHtmlPainterArgs>) Paints the required HTML template inside an element that raised this event.

Remarks

The CustomDrawTabHeader event fires repeatedly for each tab. You can identify the currently processed tab from the event’s TabHeaderInfo parameter. To paint custom information, use the methods provided by the Cache or Graphics event parameter.

When you handle the CustomDrawTabHeader event, you can invoke the default rendering of the current tab or its individual elements with the following methods:

  • DefaultDraw - Performs the default rendering of the tab (including all its elements)
  • DefaultDrawBackground - Performs the default rendering of the tab’s background.
  • DefaultDrawButtons - Performs the default rendering of the tab’s close button.
  • DefaultDrawImage - Performs the default rendering of the tab’s image ( XtraTabPage.ImageOptions)
  • DefaultDrawText - Performs the default rendering of the tab’s text (XtraTabPage.Text).

Set the Handled event parameter to true to indicate that you have handled the CustomDrawTabHeader event and no default painting is required after your event handler is completed. If the event’s Handled parameter is set to false (the default value), the default painting mechanism will automatically be invoked after your custom draw event handler is completed. The default painting mechanism overrides all rendering you may have performed previously.

See Also