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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.

# Polygon Drawing

#### Replies:

61487 May 26,2007 12:40 PM UTC May 28,2007 05:07 AM UTC WinForms 2
 Subscribe to this post Tags: Diagram
Faheem Rauf
Asked On May 26, 2007 12:40 PM UTC

Hi, can you please guide me how to draw a polygon, and rotate it to certain angle.
Regards,

Meera Fathima [Syncfusion]
Replied On May 28, 2007 04:30 AM UTC

Hello Ali,

Thank you using Essential Diagram.

If you want to draw a polygon shape node, please see the sample code snippet provided below.

private void CreatePolygon()
{
PointF[] pts = new PointF[]
{
new PointF(20, 40),
new PointF(100,60),
new PointF(100, 120),
new PointF(20,100)
};
Polygon polygon = new Polygon( pts );
this.diagram1.Model.AppendChild(polygon);
}

This is also demonstrated in the Diagram Samples\Symbol Design\Simple Flow sample. Please look into the sample's MainForm.CreateCustomPolygon() method in particular.

Thanks,
Meera

Meera Fathima [Syncfusion]
Replied On May 28, 2007 05:07 AM UTC

Hello Ali,

Continuing with my previous update, the nodes can be rotated by using the Node.Rotate() method. For e.g. if you want to rotate the polygon to certain angle,you can do this by using polygon.Rotate(45) method.

Please see the sample code snippet that shows how to do this.

private void CreatePolygon()
{
PointF[] pts = new PointF[]
{
new PointF(20, 40),
new PointF(100,60),
new PointF(100, 120),
new PointF(20,100)
};
Polygon polygon = new Polygon( pts );
polygon.Rotate(45); // Rotates polygon to 45 degree.
this.diagram1.Model.AppendChild(polygon);
}

Thanks,
Meera.

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.