windowsforms-devexpress-dot-utils-dot-dragdrop-dot-dxdrageventargs-bef36a4c.md
Gets or sets the mouse pointer.
Namespace : DevExpress.Utils.DragDrop
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
public Cursor Cursor { get; set; }
Public Property Cursor As Cursor
| Type | Description |
|---|---|
| Cursor |
A Cursor enumeration value that specifies the mouse pointer.
|
Use the mouse pointer to give feedback to users during a drag-and-drop operation. For example, if the AllowDrop argument in a DragEnter event handler is set to false, you can use the Cursor property to indicate that the operation is not allowed.
This example shows how to prohibit to drop specific data.
private void dragDropEvents1_DragEnter(object sender, DragEnterEventArgs e) {
List<TreeListNode> list = e.Data as List<TreeListNode>;
// You can prohibit to drop specific data.
if (list.Find((x) => x.GetValue(colDEPARTMENT1).ToString().Contains("Finance")) != null) {
e.AllowDrop = false;
e.Cursor = Cursors.No;
e.Handled = true;
}
}
private void dragDropEvents1_DragOver(object sender, DevExpress.Utils.DragDrop.DragOverEventArgs e) {
List<TreeListNode> list = e.Data as List<TreeListNode>;
// You can prohibit to drop specific data.
if (list.Find((x) => x.GetValue(colDEPARTMENT1).ToString().Contains("Finance")) != null) {
e.Cursor = Cursors.No;
e.Handled = true;
}
}
Private Sub dragDropEvents1_DragEnter(ByVal sender As Object, ByVal e As DevExpress.Utils.DragDrop.DragEnterEventArgs) _
Handles dragDropEvents1.DragEnter
Dim list As List(Of TreeListNode) = TryCast(e.Data, List(Of TreeListNode))
' You can prohibit to drop specific data.
If list.Find(Function(x) x.GetValue(colDEPARTMENT1).ToString().Contains("Finance")) IsNot Nothing Then
e.AllowDrop = false
e.Cursor = Cursors.No
e.Handled = True
End If
End Sub
Private Sub dragDropEvents1_DragOver(ByVal sender As Object, ByVal e As DevExpress.Utils.DragDrop.DragOverEventArgs) _
Handles dragDropEvents1.DragOver
Dim list As List(Of TreeListNode) = TryCast(e.Data, List(Of TreeListNode))
' You can prohibit to drop specific data.
If list.Find(Function(x) x.GetValue(colDEPARTMENT1).ToString().Contains("Finance")) IsNot Nothing Then
e.Cursor = Cursors.No
e.Handled = True
End If
End Sub
Note
Run the XtraTreeList or XtraGrid demo and click Open Solution for more examples.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Cursor 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.
drag-drop-grid-rows-to-treelist/CS/DragAndDropRows/Form1.cs#L114
e.Handled = true;
e.Cursor = Cursors.Default;
}
drag-drop-grid-rows-to-treelist/VB/DragAndDropRows/Form1.vb#L109
e.Handled = True
e.Cursor = Cursors.Default
End Sub
See Also