gulliver
Feb 4th, 2001, 02:54 PM
***This message was originally posted in the general Q&A section but I was having no luck - hopefully I'll get more help here...***
Can someone please help me? I have a form with two picture boxes, picDragDrop1 and picDragDrop2. I have an image in both (the same image) but in picDragDrop1 it is visible and in picDragDrop2 it is not visible.
I am trying to code the dragdrop and dragover procedures so that:
1) when the picture is dragged out of the first picture box and is dropped on the form, it appears to "snap" back into the first picture box
2) when the picture is dragged out of the first picture box and is dropped onto the second picture box, it appears in the second picture box but vanishes from the first (i.e. as if it "moved")
3) when the picture is dragged within the first picture box or is dragged around anywhere on the form but then dropped back onto the first picture box, it reappears in the first picture box as it originally was.
I am having trouble only with this last part (part 3). When I drop it back onto the first picture box it vanishes completely. Why is this? Here is the code I have so far:
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
picDragDrop1.Visible = True
End Sub
Private Sub picDragDrop1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
picDragDrop1.Visible = False
End Sub
Private Sub picDragDrop2_DragDrop(Source As Control, X As Single, Y As Single)
picDragDrop2.Picture = Source.Picture
End Sub
Can someone please help me? I have a form with two picture boxes, picDragDrop1 and picDragDrop2. I have an image in both (the same image) but in picDragDrop1 it is visible and in picDragDrop2 it is not visible.
I am trying to code the dragdrop and dragover procedures so that:
1) when the picture is dragged out of the first picture box and is dropped on the form, it appears to "snap" back into the first picture box
2) when the picture is dragged out of the first picture box and is dropped onto the second picture box, it appears in the second picture box but vanishes from the first (i.e. as if it "moved")
3) when the picture is dragged within the first picture box or is dragged around anywhere on the form but then dropped back onto the first picture box, it reappears in the first picture box as it originally was.
I am having trouble only with this last part (part 3). When I drop it back onto the first picture box it vanishes completely. Why is this? Here is the code I have so far:
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
picDragDrop1.Visible = True
End Sub
Private Sub picDragDrop1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
picDragDrop1.Visible = False
End Sub
Private Sub picDragDrop2_DragDrop(Source As Control, X As Single, Y As Single)
picDragDrop2.Picture = Source.Picture
End Sub