CustomDrawObjectEventsArgs.Handled Property
Gets or sets whether an event is handled. If true, the default actions are not required.
Namespace: DevExpress.XtraSpreadsheet
Assembly: DevExpress.XtraSpreadsheet.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
Boolean | true if default painting isn’t required; otherwise, false. |
Remarks
The events used to custom paint the SpreadsheetControl’s elements fire before these elements are painted in their default manner. If the event parameter’s Handled property is set to true, default painting is not performed. Otherwise, the SpreadsheetControl’s standard drawing mechanism overrides any custom painting.
You can call the CustomDrawObjectEventsArgs.DrawDefault method in the event handler to use the default drawing mechanism to render an element, and then set Handled to true to paint custom drawing over default graphics.
The code example below shows how to use the CustomDrawCellBackground event to draw a custom shape over default rendering for cells that contain 0 in the “Units In Stock” column.
spreadsheetControl1.CustomDrawCellBackground += (s, e) =>
{
if (e.Cell.ColumnIndex == 2 && e.Cell.Value == 0)
{
int size = 10;
e.BackColor = Color.LightPink;
e.DrawDefault();
e.Handled = true;
e.Cache.FillEllipse(Color.Red, new Rectangle(e.Bounds.Left + size, e.Bounds.Top + size / 2, size, size));
}
};
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Handled property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.