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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Find if Point lies Inside a polygon

Thread ID:

Created:

Updated:

Platform:

Replies:

100466 Aug 9,2011 09:35 AM UTC Aug 16,2011 03:37 AM UTC WinForms 1
loading
Tags: Diagram
John Previn Kumar
Asked On August 9, 2011 09:35 AM UTC

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


Pandi Murugan A [Syncfusion]
Replied On August 16, 2011 03:37 AM UTC

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.

Warning Icon 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.Close Icon

;