Drawing and get coordinate problem

retkehing

Well-known member
Joined
Feb 5, 2006
Messages
153
Programming Experience
Beginner
How to mark a dot on certain portion of form? In other words, I want to define a width and height of form portion for marking dot, and finally i wanna get the dot x and y coordinte, I need the command for getting coordinate. For example, mark two dots on the defined form portion and retrieve the x, y coordinate for both dots in order for distance calculation between these dots.
 
Last edited:
Surely if you're marking these dots you already have the coordinates. If the idea is that the user clicks the the form and you want the coordinates of the point they clicked then you need to look at handling mouse events, like MouseDown, which tells you the coordinates of the mouse pointer at the moment the button was depressed.
 
Any drawing component in VB.net can enable the mark of dot on the form? Besides, what is the mouse event command for getting the x, y coordinate?
 
retkehing said:
Any drawing component in VB.net can enable the mark of dot on the form?
You use GDI+ for any drawing in .NET apps. Handle the Paint method of the form and use the e.Graphics property to do the drawing. There is no DrawPoint method, so you have to use DrawLine or DrawRectangle with the apprpriate dimensions to look like a dot.
retkehing said:
Besides, what is the mouse event command for getting the x, y coordinate?
Handle the MouseDown event. As always, all the interesting information is passed as properties of the 'e' parameter.
 
Back
Top