Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you use the region class for hit testing?..

Status
Not open for further replies.

iara

Programmer
Oct 2, 2002
17
HN
I have a shape Example : ellipse and would like to perform hit testing on it so when the mouse passes over this ellipse on the screen some other drawings wil appear..
I have been trying to find some help on the internet and I have not found any, does anyone know of some site to do this? I did not find much help in the dotnet site. well thanks.
 
Try to do the following:

Point point = new point(test_x, test_y);
Rectangle rect(x,y, width, height);
GraphicsPath path = new GraphicsPath();
Path.StartFigure();
Path.AddEllipse(rect);
Path.CloseFigure();
Region region = new Region(path);
if(region.IsVisible(point))
{
//the point is inside the ellipse
}

 
thanks for the reply, I have tried this, but I just get no change of state. I tried to change the color of the brush while the mouse points at the ellipse but nothing happens. It does not read to mouse click. Im just wondering should there be some other way to do this?
regards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top