PDA

Click to See Complete Forum and Search --> : Mousepos and Move


progeix
Dec 30th, 1999, 10:27 PM
Hey I need a way to, where you click on a picture on the form, and then where ever you will click this out picture will move to.

As in, top left of picture is 0,0 bottom right is like 500,300 i'm not sure right now but this will start me off.
Thanks

mwdelta
Dec 31st, 1999, 01:34 AM
Well, you should be able to use the MouseDown event of whatever the mouse is over when you click to move the picture. Say there's nothing there but the form, you could use:

Public imgClicked as Boolean

Private Sub Image1_Click()
imgClicked = True
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If imgClicked = True then
Image1.Left = X
Image1.Top = Y
imgClicked = False
End If
End Sub

After you click on Image1, then click somewhere else on the form and this will move Image1 to wherever you click. Hope this helps.

------------------
Mike Wellems
PowerQuery