472,119 Members | 1,651 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

How to find point in region


Hello,
I have drawn polygon on window. And I want to check wheather given
point is in that polygon region or not? How shold I find that? I have
created object of class region

GraphicsPath path = new GraphicsPath();
path.AddPolygon(pts); //////// Some points I have passed
Region rgn = new Region(path);
RegionData rgnDta = rgn.GetRegionData();

Now I have to check Wheather any point That I will give is in that
Region or not?

Please send me solution of this problem.
Thanks in advance.

Jan 9 '07 #1
1 8153
Hi Renu,

All you need to do is use the GraphicsPath to do the HitTesting
this will do what you want.

public bool HitTest(Point p)
{
if(path.IsVisible(p))
return(true);
else
return(false);
}

Mike Powell
www.ramuseco.com

"renu" <re*************@gmail.comwrote in message
news:11**********************@51g2000cwl.googlegro ups.com...
>
Hello,
I have drawn polygon on window. And I want to check wheather given
point is in that polygon region or not? How shold I find that? I have
created object of class region

GraphicsPath path = new GraphicsPath();
path.AddPolygon(pts); //////// Some points I have passed
Region rgn = new Region(path);
RegionData rgnDta = rgn.GetRegionData();

Now I have to check Wheather any point That I will give is in that
Region or not?

Please send me solution of this problem.
Thanks in advance.

Jan 9 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Brian Basquille | last post: by
3 posts views Thread by Peter Proost | last post: by
3 posts views Thread by illusion.admins | last post: by
3 posts views Thread by Grant Edwards | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.