Visual Basic Reference
DragIcon Property Example
This example changes the DragIcon property setting each time you drag a PictureBox control. To try this example, paste the code into the Declarations section of a form that contains a PictureBox control. Set the DragMode property = 1, and then press F5 and click and drag the PictureBox control.
Private Sub Form_DragDrop (Source As Control, X As Single, Y As Single)
Dim Pic ' Declare variable.
Source.Move X, Y ' Set position of control.
Pic = "ICONS\OFFICE\CRDFLE01.ICO" ' Get name of icon file.
If Source.DragIcon = False Then ' If no picture loaded,
Source.DragIcon = LoadPicture(Pic) ' load picture.
Else
Source.DragIcon = LoadPicture() ' Unload picture.
End If
End Sub