Skip to main content
All docs
V24.2

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

BaseGallery.CustomDraw Event

Allows you to draw the gallery manually.

Namespace: DevExpress.XtraBars.Ribbon.Gallery

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DXCategory("Events")]
public event EventHandler<ImageGalleryCustomDrawEventArgs> CustomDraw

#Event Data

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

Property Description
Appearance Gets the gallery’s appearance settings.
Bounds Gets the bounding rectangle of the displayed ribbon gallery.
Gallery Gets the current gallery.
Info Gets information about the displayed gallery.
Painter Gets an object that performs paint operations.

The event data class exposes the following methods:

Method Description
DefaultDrawBackground() Uses default drawing logic to draw the gallery’s background.
DefaultDrawGroups() Uses default drawing logic to draw the gallery’s groups.
DefaultDrawMarqueeSelection() Uses default drawing logic to draw the gallery’s marquee selection.

#Remarks

The following code sample displays the gallery control with a custom background:

private void galleryControl1_Gallery_CustomDraw(object sender, DevExpress.XtraBars.Ribbon.ImageGalleryCustomDrawEventArgs e) {
    e.Cache.FillRectangle(Color.Red, e.Bounds);
    e.DefaultDrawGroups();
    e.DefaultDrawMarqueeSelection();
    e.Handled = true;
}
See Also