Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specify mouse coordinates

Status
Not open for further replies.

ameedoo3000

IS-IT--Management
Sep 20, 2016
233
EG
hi all
in my form i have a control(Image).i want the code to make the left or top of this control as my mouse(left or top) in this form.how that?
 
ameedoo3000,
Do you mean, you want the top and left of the image control to appear under the mouse pointer? You mention left or top? Can you explain what you're trying to accomplish, because this doesn't make much sense to me...


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Yes I want to know the top and left place where the mouse in the form to attract the picture.
 
Look at the mousemove method of the form it has the coordinates.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
i want where i click the mouse in the form the picture move to that point. how that?
 
The get the mouse coordinates put this in the mousemove event of the form:
Code:
LPARAMETERS nButton, nShift, nXCoord, nYCoord
MESSAGEBOX('X:'+TRANSFORM(nXCoord)+' Y:'+TRANSFORM(nYCoord))

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
yes. now every thing is ok.
thank you very very much dear "Mike Gagnon".
 
But if the idea is to let the use move a picture on a form, I would recommend using Drag and Drop instead. Because with the mousemove event it will trigger anytime the user clicks on the form and may become frustrating to the user.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I agree with Mike G about drag-and-drop. But if you really want to move the image to the current mouse co-ordinates, you can do so like this:

Code:
* In the form's MouseMove event
LPARAMETERS nButton, nShift, nXCoord, nYCoord
THISFORM.MyImage.Move(nXCoord, nYCoord)

But the effect will be weird. Asa the user moves the mouse around the form, the image will simply follow it - except when the mouse moves over another control within the form. Also, there will be no way to "release" this behaviour, that is, the user won't be able to "drop" the image at its new position. Nor will they easily be able to interact with other controls on the form. Is that really what you want?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Sorry for the delay in reply.
Yes, that's exactly what I want specifically.
I am also completely convinced with your Opinion.
Thank you very very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top