Draws a polygon defined by an array of Point structures.
Namespace:
Aurigma.GraphicsMill.Drawing
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
public void DrawPolygon( Pen pen, Point[] points )
Type: Aurigma.GraphicsMill.Drawing.Pen
A Pen that determines the color, width, and style of the polygon.Type: System.Drawing.Point[]
An array of Point structures that represent the vertices of the polygon.Polygon can be treated as closed polyline, where last point is connected with the first one.
To fill the polygon, use FillPolygon(Brush, Point[], FillMode) method.
using (var bitmap = new Bitmap(185, 145, PixelFormat.Format24bppRgb, RgbColor.White)) { using (Graphics graphics = bitmap.GetGraphics()) { //Draw filled and outlined rectangle var pen = new Pen(RgbColor.Red, 3); var brush = new SolidBrush(RgbColor.Lavender); graphics.FillRectangle(brush, 10, 10, 100, 60); graphics.DrawRectangle(pen, 10, 10, 100, 60); //Draw filled but non-outlined ellipse brush.Color = RgbColor.Yellow; graphics.FillEllipse(brush, 60, 40, 100, 80); //Draw outlined but non-filled polygon pen.Color = RgbColor.Green; pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; pen.Width = 2; System.Drawing.Point[] points = { new System.Drawing.Point(20, 30), new System.Drawing.Point(50, 2), new System.Drawing.Point(180, 30), new System.Drawing.Point(80, 140) }; graphics.DrawPolygon(pen, points); } bitmap.Save(@"Images\Output\shapesGDI.png"); }