Sure thing.
Make sure you set the DragIcon property to the apropriate cursor.Code:Private Type POINTAPI X As Long Y As Long End Type Private Declare Function LBItemFromPt Lib "comctl32.dll" (ByVal hwnd As Long, ByVal ptx As Long, ByVal pty As Long, ByVal bAutoScroll As Long) As Long Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long Private Sub List1_DragDrop(Source As Control, X As Single, Y As Single) Dim intCurItem As Long Dim pt As POINTAPI Dim strItem As String pt.X = X \ Screen.TwipsPerPixelX pt.Y = Y \ Screen.TwipsPerPixelY Call ClientToScreen(List1.hwnd, pt) intCurItem = LBItemFromPt(List1.hwnd, pt.X, pt.Y, False) If intCurItem > -1 Then strItem = List1.List(List1.ListIndex) List1.RemoveItem List1.ListIndex List1.AddItem strItem, intCurItem End If End Sub Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then List1.Drag vbBeginDrag End If End Sub




Reply With Quote