Back to Devexpress

CustomDrawEventArgs.Handled Property

windowsforms-devexpress-dot-xtratreelist-dot-customdraweventargs-d2139798.md

latest5.2 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.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

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 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-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/TreeList/TreeListItemControlProvider.cs#L50

csharp
e.Cache.DrawString(validationError, e.Appearance.Font, e.Cache.GetSolidBrush(Color.Black), e.Bounds);
    e.Handled = true;
}

winforms-treelist-implement-group-level-style-feature/CS/Q220534/Form1.cs#L23

csharp
{
    e.Handled = true;
    TreeList tree = (TreeList)sender;

winforms-treelist-show-checkboxes-for-specific-level/CS/WindowsApplication1/Form1.cs#L91

csharp
e.ObjectArgs.State = DevExpress.Utils.Drawing.ObjectState.Disabled;
    e.Handled = NeedHide;
}

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/TreeList/TreeListItemControlProvider.vb#L56

vb
e.Cache.DrawString(validationError, e.Appearance.Font, e.Cache.GetSolidBrush(Color.Black), e.Bounds)
    e.Handled = True
End Sub

winforms-treelist-implement-group-level-style-feature/VB/Q220534/Form1.vb#L21

vb
Private Sub OnTreeListCustomDrawNodeIndent(ByVal sender As Object, ByVal e As CustomDrawNodeIndentEventArgs) Handles treeList.CustomDrawNodeIndent
    e.Handled = True
    Dim tree As TreeList = DirectCast(sender, TreeList)

winforms-treelist-show-checkboxes-for-specific-level/VB/WindowsApplication1/Form1.vb#L95

vb
e.ObjectArgs.State = DevExpress.Utils.Drawing.ObjectState.Disabled
    e.Handled = NeedHide
End Sub

See Also

Graphics

Bounds

DefaultDraw()

CustomDrawEventArgs Class

CustomDrawEventArgs Members

DevExpress.XtraTreeList Namespace