I modify your code as below: ------------------------------------------------------------------------------------------------------- Option Explicit
Private Sub Form_Load() tvwExplorer.OLEDragMode = xtpOLEDragAutomatic tvwExplorer.OLEDropMode = xtpOLEDropManual tvwExplorer.Nodes.Add , , "node1", "node1" tvwExplorer.Nodes.Add , , "node2", "node2" tvwExplorer.Nodes.Add , , "node3", "node3" tvwExplorer.Nodes.Add , , "node4", "node4" End Sub
Private Sub tvwExplorer_OLEStartDrag(Data As XtremeSuiteControls.DataObject, AllowedEffects As Long) Dim oDragNode As TreeViewNode
If Not Me.tvwExplorer.SelectedItem Is Nothing Then ' check if valid ... AllowedEffects = vbDropEffectMove Else AllowedEffects = vbDropEffectNone End If
End Sub
Private Sub tvwExplorer_OLEDragDrop(ByVal Data As XtremeSuiteControls.DataObject, Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single) ' do what u need ' nothing about Effect If MsgBox("Select yes to set Effect = vbDropEffectMove, Select no to set Effect = vbDropEffectCopy ", vbYesNo, "Yes") = vbYes Then Effect = vbDropEffectMove Else Effect = vbDropEffectCopy End If End Sub
Private Sub tvwExplorer_OLECompleteDrag(Effect As Long) MsgBox "result:" & IIf(Effect = vbDropEffectMove, "vbDropEffectMove", "vbDropEffectCopy"), vbOKOnly End Sub
--------------------------------------------------------------------------------------------------------
Above code, in tvwExplorer_OLEDragDrop event, whether set Effect = vbDropEffectMove or set Effect = vbDropEffectCopy in tvwExplorer_OLECompleteDrag event, Effect always is vbDropEffectMove , this is not right, it should be the same as the value in tvwExplorer_OLEDragDrop .
Thanks!
|