problems with mousemove

homer2002

Registered User.
Local time
Today, 14:32
Joined
Aug 27, 2002
Messages
152
I am trying to use a mousemove or mousedown event to catch where the cursor is on a form. Problem is when I save the X and Y variable it is never the same as I think it should be.


maybe an example
(Make imgMyImage on any old form)

______________________________________________

Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MyXPos = x
MyYPos = y
End sub

private sub Move_Image_To_Same_Place_As_MouseDown_Event()
imgMyImage.Left = myXPos
imgMyImage.Top = myYPos
end sub


______________________________________________

When I run the Move_Image sub
the image never returns to where I clicked.
HELP ME:)
 
This worked for me:
Code:
Option Compare Database
Dim varX, varY

Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  varX = X
  varY = Y
End Sub

Private Sub Detail_Click()
  img1.Left = varX
  img1.Top = varY
End Sub
 

Users who are viewing this thread

Back
Top Bottom