DragDrop problem with PictureBox

hokuyo
05-06-2006, 06:11 PM
I have two pictureboxes on my form: MapPicture and VictimPic. What I need to do is to be able to drag VictimPic onto MapPicture so that when the user drops it VictimPic will be moved onto MapPicture at the point it was dropped.

I went through all of the posts about similar issues, and Iceplug's tutorials were helpful, but I am still encountering problems: using the PointToClient method, which I know very little about, always will just move VictimPic around the form instead of the picturebox. That is when I use:


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

However, when I use:


Dim Px As Point = New Point(e.X, e.Y)
Px = Me.PointToClient(Px)
PB.Location = Px

the VictimPic will just disappear after the DragDrop. I think that maybe it is moving to the location, but that it is underneath the PictureBox. Interestingly enough, if VictimPic starts on MapPicture at runtime, it works perfectly. But that doesn't really help me.

Thanks in advance for any help.

jwakeman
05-13-2006, 06:16 PM
Have you tried PB.bringtofront at the end of the second bit of code?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum