Detecting clicks within a polygon

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

Guest

I am drawing a set of polygons, currently using graphics.DrawPolygon(...
What i want to do, is when the user clicks in the area of a polygon, to be
able to work out which polygon they have clicked in.
Could anyone suggest the easiest way of doing this, even if i have to change
the way i'm drawing the polygons?
 
What i want to do, is when the user clicks in the area of a polygon, to be
able to work out which polygon they have clicked in.
Could anyone suggest the easiest way of doing this, even if i have to change
the way i'm drawing the polygons?

You could create a GraphicsPath from the polygon points and then call
its IsVisible method.

Or you could use an algorith specifically for this. See Q 2.03 at
http://www.faqs.org/faqs/graphics/algorithms-faq/



Mattias
 
Back
Top