Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

OleDrag2 Sample (VB.NET)

This sample illustrates SftDirectory as a drag source (drag & drop).

This is not an executable sample, so a complete project is not provided. These statements are intended to show the syntax used.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AxSftDirectory1.OLEDragMode = SftControlOLEDragModeConstants.OLEDragSftControlManual
End Sub

Private Sub AxSftDirectory1_DragStarting(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_DragStartingEvent) Handles AxSftDirectory1.DragStarting
    Dim F As SftDirectoryFolder
    F = AxSftDirectory1.CurrentFolder
    If Not F Is Nothing Then
        AxSftDirectory1.OLEDrag(False, True, -1, -1)
    End If
End Sub

Private Sub AxSftDirectory1_OLEStartDrag(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLEStartDragEvent) Handles AxSftDirectory1.OLEStartDrag
    e.data.Clear()
    e.data.SetData(Nothing, SftOLEClipboardConstants.sftCFText)
    e.allowedEffects = 1 'vbDropEffectCopy
End Sub

Private Sub AxSftDirectory1_OLESetData(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLESetDataEvent) Handles AxSftDirectory1.OLESetData
    If e.format = SftOLEClipboardConstants.sftCFText Then
        e.data.SetData("We're dragging a text string - """ & AxSftDirectory1.CurrentFolder.Name & """ - drop it in Write, Word (for example)", SftOLEClipboardConstants.sftCFText)
    End If
End Sub

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.