SimpleButton.CustomDraw Event
Allows you to draw the button manually.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v25.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
[DXCategory("Appearance")]
public event EventHandler<ButtonCustomDrawEventArgs> CustomDraw
Event Data
The CustomDraw event's data class is ButtonCustomDrawEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Bounds | Gets button bounds. |
| Info | Gets information about the drawn button. |
| Painter | Provides access to the object that performs paint operations. Inherited from ObjectCustomDrawEventArgs. |
The event data class exposes the following methods:
| Method | Description |
|---|---|
| DefaultDrawBackground() | Draws the button background in its default appearance. |
| DefaultDrawImage() | Draws the button image in its default appearance. |
| DefaultDrawText() | Draws button text in its default appearance. |
Remarks
The following code snippet handles the CustomDraw event to change the button’s hovered background:

void simpleButton1_CustomDraw(object sender, DevExpress.XtraEditors.ButtonCustomDrawEventArgs e) {
if(e.Info.State == DevExpress.Utils.Drawing.ObjectState.Hot) {
e.Cache.FillRectangle(Brushes.Orange, e.Bounds);
e.DefaultDrawImage();
e.DefaultDrawText();
e.Handled = true;
}
}
See Also