We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Find if Point lies Inside a polygon

Thread ID:

Created:

Updated:

Platform:

Replies:

100466 Aug 9,2011 05:35 AM Aug 15,2011 11:37 PM Windows Forms 1
loading
Tags: Diagram
John Previn Kumar
Asked On August 9, 2011 05:35 AM

Is there a way to find if a point (x,y) lies inside a polygon?


Pandi Murugan A [Syncfusion]
Replied On August 15, 2011 11:37 PM

Hi JVM,

Thanks for using Syncfusion products.

We suggest you to use Node.Contains(PointF pt) method to achieve your requirement. Here is the code snippet for your reference.

[C#]
diagram1.MouseUp += new MouseEventHandler(diagram1_MouseUp);
void diagram1_MouseUp(object sender, MouseEventArgs e)
{
PointF curPt = diagram1.Controller.ConvertToModelCoordinates(e.Location);
Node node = diagram1.Controller.GetNodeAtPoint(curPt);
if (node != null)
{
if(node.ContainsPoint(curPt)){
MessageBox.Show("Point inside!");
}
}
}


Please let me know if you have any concerns.

Regards,
Pandi Murugan A


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;