Drag and drop picturebox in a panel

torvic123

New member
Joined
Mar 12, 2007
Messages
1
Programming Experience
Beginner
Hi all,

This is my first post here. I have been reading for a while the posts and have been very helpful. However, after doing some google search and reading some info, i cannot find a solution to my problem:

i want to move a picturebox in a panel. Basically, i do:

Dim WithEvents PanelPagina As New Panel
Public WithEvents IMG1 As New PictureBox

...

PanelPagina.AllowDrop = True
...

Private Sub PanelPagina_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PanelPagina.DragDrop

Dim PB As PictureBox
PB = e.Data.GetData(IMG1.GetType)
Dim Px As Point = New Point(e.X, e.Y)
Px =
Me.PointToClient(Px)
PB.Location = Px

End Sub


Private Sub IMG1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles IMG1.MouseDown
IMG1.DoDragDrop(
Me.IMG1, DragDropEffects.Move)
End Sub


I run the program with no warnings but the effect is not performed. Can anyone help?

Thanks a lot in advance.


 
Back
Top