Graphics question
-
I have a circle, or any polygon, drawn on a form via VB.NET (2k5 in this case). I would like to know if my cursor is inside of the circle/polygon. Is there an easy way to know this. I've been tinkering with the use of the x,y location of the mouse pointer, but don't know how to convert this into the location of the circle. Thanks in advance for any advice.
-
I have a circle, or any polygon, drawn on a form via VB.NET (2k5 in this case). I would like to know if my cursor is inside of the circle/polygon. Is there an easy way to know this. I've been tinkering with the use of the x,y location of the mouse pointer, but don't know how to convert this into the location of the circle. Thanks in advance for any advice.
I am not 100% sure of how to do this, but you could try looking at the Region.Intersect function. For example, if each of your graphics objects have an associated region, you could test to see if a point (mouse cursor) intersects with your region. If the result region is empty then there is no hit.
-
I am not 100% sure of how to do this, but you could try looking at the Region.Intersect function. For example, if each of your graphics objects have an associated region, you could test to see if a point (mouse cursor) intersects with your region. If the result region is empty then there is no hit.