Поделиться через


InDrag Property (SelectionEventArgs)

Topic Last Modified: 2006-11-30

Specifies whether the TreeView control is currently in drag-drop mode. The InDrag property applies to the SelectionEventArgs Class.

Syntax

Property InDrag As Boolean
bool InDrag;

Parameters

Property Value/Return Value

Exceptions

Remarks

This property is read-only.

Example

The following Visual Basic .NET example shows a Selection Event handler function that displays whether or not the control is in drag-drop mode.

Private Sub OnSelection(ByVal o As Object, ByVal e As EventArgs) Handles treeView.Selection

     ' Declare the SelectionEventArgs object.
     Dim evtArgs As SelectionEventArgs

     ' Cast e to a SelectionEventArgs object.
     evtArgs = CType(e, SelectionEventArgs)

     If evtArgs.InDrag Then
       Debug.WriteLine("Control is in drag-drop mode.")
     Else
       Debug.WriteLine("Control is not in drag-drop mode.")
     End If
End Sub

The following C# example shows a Selection Event handler function that displays whether or not the control is in drag-drop mode.

void OnSelection(object o, EventArgs e )
{
     // Cast e to a SelectionEventArgs object.
     SelectionEventArgs evtArgs = (SelectionEventArgs)e;

     if(evtArgs.InDrag)
          Debug.WriteLine("Control is in drag-drop mode.");
     else
          Debug.WriteLine("Control is not in drag-drop mode.");

}