Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

DropTarget Property, SftTree Class

Defines the object (item or cell) that is the current drop target during a drag & drop operation.

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

Syntax

public object DropTarget { get; set; }
Public Property DropTarget As Object

Value

The drop target object or null/Nothing if there is no drop target

The default value is null/Nothing.

Comments

Defines the object (item or cell) that is the current drop target during a drag & drop operation.

The drop target's appearance is identical to the properties defined for flyby highlighting.

The drop target is usually used while handling DragEnter, DragOver and DragDrop events. A default drop target is provided by the control automatically, but an application can override the drop target while handling these events.

Examples

C#

                e.Effect = DragDropEffects.Copy;
            else
                e.Effect = DragDropEffects.None;
        }

        private void sftTree1_DragOver(object sender, DragEventArgs e) {
            // in this example, if we don't have a valid drop target, 
            // we STILL allow drops
            if (sftTree1.DropTarget == null)
                e.Effect = DragDropEffects.Copy;
        }

        private void sftTree1_DragDrop(object sender, DragEventArgs e) {
            Debug.Write("*** sftTree1 DragDrop ");
            DumpValues(e);

VB.NET

    Else
        e.Effect = DragDropEffects.None
    End If
End Sub

Private Sub sftTree1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles sftTree1.DragOver
    ' in this example, if we don't have a valid drop target,
    ' we STILL allow drops
    If sftTree1.DropTarget Is Nothing Then
        e.Effect = DragDropEffects.Copy
    End If
End Sub

Private Sub sftTree1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles sftTree1.DragDrop
    Debug.Write("*** sftTree1 DragDrop ")
    DumpValues(e)

See Also SftTree Class | Classes | SftTree/NET 2.0