Back to Devexpress

CustomDrawEventArgs.Handled Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-customdraweventargs-8ba3605f.md

latest6.9 KB
Original Source

CustomDrawEventArgs.Handled Property

Gets or sets a value specifying whether an event was handled and that the default element painting is therefore not required.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
public bool Handled { get; set; }
vb
Public Property Handled As Boolean

Property Value

TypeDescription
Boolean

true if the default element painting is not required; otherwise, false.

|

Remarks

If custom drawing is implemented and the Handled property value remains set to false , all the custom drawing performed will be overwritten by the default painting mechanism using the appearance settings. These appearance settings are specified by the CustomDrawEventArgs.Appearance property.

Set the Handled property to true to prevent the default painting mechanism from clearing any custom drawing after a custom draw event handler has been completed.

The CustomDrawEventArgs.DefaultDraw method, when called, automatically sets the Handled property to true.

The CustomDrawEventArgs.DefaultDraw method does nothing if the Handled property has already been set to true.

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.

winforms-grid-print-custom-draw-content/CS/MyXtraGrid/MyGridView/MyGridView.cs#L29

csharp
FooterCellCustomDrawEventArgs args = new FooterCellCustomDrawEventArgs(cache, -1, col, null, styleArgs);
args.Handled = true;
RaiseCustomDrawFooterCell(args);

winforms-grid-multiple-row-selection-web-style-checkboxes/CS/E1271/CheckMarkSelection.cs#L234

csharp
DrawCheckBox(e.Cache, e.Bounds, SelectedCount == _view.DataRowCount);
    e.Handled = true;
}

winforms-grid-enable-editing-in-group-row-to-change-cell-values/CS/WindowsApplication3/GroupEditProvider.cs#L198

csharp
DrawGroupEditor(e);
    e.Handled = true;
}

winforms-grid-highlight-cell-values-matching-text-in-autofilterrow/CS/CarsGridWinApp15/Main.cs#L39

csharp
e.Cache.Paint.DrawMultiColorString(e.Cache, e.Bounds, e.DisplayText, filterCellText, e.Appearance, Color.Black, Color.Gold, false, filterTextIndex);
    e.Handled = true;
}

winforms-grid-keep-groups-expanded/CS/KeepGroupsExpanded/Form1.cs#L31

csharp
ObjectPainter.DrawObject(e.Cache, e.Painter, e.Info);
    e.Handled = true;
}

winforms-grid-print-custom-draw-content/VB/MyXtraGrid/Form1.vb#L33

vb
Private Sub myGridView1_CustomDrawFooterCell(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs) Handles myGridView1.CustomDrawFooterCell
    Dim isPrinting As Boolean = e.Handled
    e.Handled = True

winforms-grid-multiple-row-selection-web-style-checkboxes/VB/E1271/CheckMarkSelection.vb#L274

vb
DrawCheckBox(e.Cache, e.Bounds, SelectedCount = _view.DataRowCount)
    e.Handled = True
End If

winforms-grid-enable-editing-in-group-row-to-change-cell-values/VB/WindowsApplication3/GroupEditProvider.vb#L188

vb
DrawGroupEditor(e)
    e.Handled = True
End If

winforms-grid-highlight-cell-values-matching-text-in-autofilterrow/VB/CarsGridWinApp15/Main.vb#L30

vb
e.Cache.Paint.DrawMultiColorString(e.Cache, e.Bounds, e.DisplayText, filterCellText, e.Appearance, Color.Black, Color.Gold, False, filterTextIndex)
    e.Handled = True
End Sub

winforms-grid-keep-groups-expanded/VB/KeepGroupsExpanded/Form1.vb#L33

vb
ObjectPainter.DrawObject(e.Cache, e.Painter, e.Info)
    e.Handled = True
End Sub

See Also

Appearance

DefaultDraw()

CustomDrawEventArgs Class

CustomDrawEventArgs Members

DevExpress.XtraGrid.Views.Base Namespace