- Код: Выделить всё
Private Sub Form_Load()
lst01.AddItem "Item001"
lst01.AddItem "Item002"
lst01.AddItem "Item003"
lst01.AddItem "Item004"
End Sub
Private Sub lst01_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
lst01.OLEDrag
End If
End Sub
Private Sub lst01_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
AllowedEffects = vbDropEffectCopy
Data.Clear
Data.SetData lst01.List(lst01.ListIndex), vbCFText
End Sub
Private Sub lst01_OLECompleteDrag(Effect As Long)
'Debug.Print "Ready"
End Sub
Private Sub lst01_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(vbCFText) = True Then
Debug.Print X, Y
Debug.Print "Drop"
Effect = vbDropEffectCopy
Else
Effect = vbDropEffectNone
End If
End Sub
Так, вот, вопрос, можно ли с помощью координат получить индекс элемента, или все таки придется юзать ListView и метод GetItemAt ?