Drag Picture File To Picture Box And Display The Picture

If you will drag the file mypic.gif from Windows to the picture box, the picture will be displayed within the picture box.


Add 1 Picture Box to your form.
Set the Picture Box OLEDropMode Property to 1 - manual.

Form Code

Private Sub Picture1_OLEDragDrop(Data As DataObject, Effect As Long, _
Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo Err
    Picture1.Picture = LoadPicture(Data.Files(1))
    Exit Sub
    MsgBox "The Picture you dragged could not be loaded"
End Sub

Go Back