Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to check which coordinates is near to my cursor position in a group of coordinates in vb.net
Posted
Comments
enhzflep 30-Apr-14 0:46am    
Er, by comparing them?

You should add more information to your question. Things like how you're storing the co-ordinates and what you define as 'near'.

Also, are you interested in (potentially several) points that are closer than a certain distance, or are you merely interested in the closest one?

As it stands, your question is barely better than: "How do I fix a car" - in each case, the detail that's lacking makes a useful answer close to impossible.

MAKReddy wrote a nice little program snaps the mouse to the closest coordinates. I'm sure you can use his code to do what you want it to do.
I am working on an application which draws a simple dot grid. I would like the mouse to snap between the points on the grid,[^]
 
Share this answer
 
Calculate the
Euclidean distance[^] of all coordinates to the mouse cursor and pick the one with the smallest distance.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900