Create a form.
Add 3 buttons. Call then btnA, btnB and btnC.
On btnA, modify the DragMode to 1 (Automatic).
Then add the following code:
VB Code:
Private Sub btnB_DragDrop(Source As Control, X As Single, Y As Single)
MsgBox "Dropped on B at " & X & " : " & Y
End Sub
Private Sub btnC_DragDrop(Source As Control, X As Single, Y As Single)
MsgBox "Dropped on C at " & X & " : " & Y
End Sub
Run the program, and drag button A to B or C.
Then extend the program a bit by:
Add two image controls. Add different Pictures to them (from the \Graphics\Icons\DragDrop folder). Add this code:
VB Code:
Private Sub btnB_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
btnA.DragIcon = Image1.Picture
End Sub
Private Sub btnC_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
btnA.DragIcon = Image1.Picture
End Sub
Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
btnA.DragIcon = Image2.Picture
End Sub