Clicking on a path between points

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am drawing two points (which could have any coordinates), and a path between them. The problem is, I want to know when a user clicks on this path between them. I am confused as to how I would do this. Do I have to get deep into math to calculate the linear path from one point to another, and then manually check if the coords of the mouse line up on this line? Is there a .NET function already for this

Also, I'm pretty sure this is not possible, but is there any way to tie an event handler to a specific thing happening? Like, can I specify that when a user scrolls over a certain region of the form, a certain event will be fired? I'm guessing not, and that I have to consume the MouseOver event and just check if the mouse is in that region..

Thanks

Yaron
 
The GDI+ FAQ has an article on hit-testing lines that will help you.

--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*

The GDI+ FAQ: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder/GetFeed.aspx?FeedId=41

*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*





Yaron said:
Hi,

I am drawing two points (which could have any coordinates), and a path
between them. The problem is, I want to know when a user clicks on this path
between them. I am confused as to how I would do this. Do I have to get deep
into math to calculate the linear path from one point to another, and then
manually check if the coords of the mouse line up on this line? Is there a
..NET function already for this?
Also, I'm pretty sure this is not possible, but is there any way to tie an
event handler to a specific thing happening? Like, can I specify that when a
user scrolls over a certain region of the form, a certain event will be
fired? I'm guessing not, and that I have to consume the MouseOver event and
just check if the mouse is in that region...
 
Back
Top