Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

DragDetected Event, SftTree Class

Occurs when the user starts dragging an object.

Class: SftTree
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public event DragDetectedEventHandler DragDetected;
Public Event DragDetected As DragDetectedEventHandler

Comments

Occurs when the user starts dragging an object.

This event is only available when the SftTree.DragStyle property is defined to detect drag operations (DragStyleEnum.Detect).

The DragStarting event is only used to signal that the user has requested a drag & drop operation. The actual implementation of the drag & drop operation is delegated to the container, which must support drag & drop between controls.

The Handled field of the DragDetectedEventArgs class instance must be set to True, if the application performs drag & drop (usually by invoking SftTree.DoDragDrop), otherwise the tree control's built-in action (such as column reordering) will also be performed.

Examples

C#

            sftTree1.AutoExpandDragDrop = true;
            sftTree1.AutoExpandArea = AutoExpandAreaEnum.AllColumns;
            sftTree1.Initializing = false;

            // We also need to set up the text box so we can drop data
            textBox1.AllowDrop = true;
        }

        private void sftTree1_DragDetected(object sender, DragDetectedEventArgs e) {
            Debug.Print("We're starting to drag something");
            DumpValues(e);

            // based on what we are dragging, make up a string
            string s = "";
            s = e.Area.ToString() + " in ";
            s += e.Item.UsageLocation.ToString() + ": ";

VB.NET

    sftTree1.AutoExpandDragDrop = True
    sftTree1.AutoExpandArea = AutoExpandAreaEnum.AllColumns
    sftTree1.Initializing = False

    ' We also need to set up the text box so we can drop data
    textBox1.AllowDrop = True
End Sub

Private Sub sftTree1_DragDetected(ByVal sender As Object, ByVal e As Softelvdm.SftTreeNET.DragDetectedEventArgs) Handles sftTree1.DragDetected
    Debug.Print("We're starting to drag something")
    DumpValues(e)

    ' based on what we are dragging, make up a string
    Dim s As String = ""
    s = e.Area.ToString() & " in "
    s = s & e.Item.UsageLocation.ToString() & ": "

See Also SftTree Class | Classes | SftTree/NET 2.0