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

LayoutGroup.CustomDrawCaption Event

Allows you to custom paint the caption region.

Namespace: DevExpress.XtraLayout

Assembly: DevExpress.XtraLayout.v20.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("CustomDraw")]
public event EventHandler<GroupCaptionCustomDrawEventArgs> CustomDrawCaption

Event Data

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

Property Description
Cache Provides access to the drawing surface and a cache of pens, fonts, and brushes. Inherited from ObjectCustomDrawEventArgs.
CaptionBounds Gets the painted caption’s bounding rectangle.
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 Gets information on the painted group.
Painter Provides access to the object that performs paint operations. Inherited from ObjectCustomDrawEventArgs.

The event data class exposes the following methods:

Method Description
DefaultDraw() Performs default painting of the control’s caption.
DefaultDrawBackground() Performs default painting of the control’s caption background.
DefaultDrawButtons() Performs default painting of the buttons embedded in the control’s caption.
DefaultDrawImage() Performs default painting of the control’s caption image.
DefaultDrawText() Performs default painting of the text in the control’s caption.

Remarks

The CustomDrawCaption event allows you to custom paint the caption. Use the GroupCaptionCustomDrawEventArgs.Info event parameter to obtain the caption’s display settings (for instance, the text, button bounds, etc.).

To draw custom information, use the methods provided by the Cache or Graphics event parameter.

When you handle the CustomDrawCaption event, you can invoke the default rendering of the caption or its individual elements with the following methods:

  • DefaultDraw - Performs the default rendering of the caption (including all its elements)
  • DefaultDrawBackground - Performs the default rendering of the caption’s background.
  • DefaultDrawButtons - Performs the default rendering of the caption’s buttons (LayoutGroup.CustomHeaderButtons
  • DefaultDrawImage - Performs the default rendering of the caption’s image (LayoutGroup.CaptionImageOptions)
  • DefaultDrawText - Performs the default rendering of the tab’s text (LayoutControlGroup.Text)

Set the Handled event parameter to true to indicate that you have handled the CustomDrawCaption 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 the LayoutControl.CustomDraw topic for more information.

See Also