public DrawPolygon ( |
||
pen | ||
points | Point | |
return | void |
using System.Drawing; Graphics graphics = this.CreateGraphics(); Pen pen = new Pen(Color.Black); Point[] points = new Point[] { new Point(10, 10), new Point(20, 30), new Point(50, 40), new Point(70, 20), new Point(60, 10), }; graphics.DrawPolygon(pen, points);
using System.Drawing; Graphics graphics = this.CreateGraphics(); Pen pen = new Pen(Color.Red, 5); Point[] points = new Point[] { new Point(10, 10), new Point(20, 30), new Point(50, 40), new Point(70, 20), new Point(60, 10), }; graphics.DrawPolygon(pen, points);This code is similar to the previous example, but it uses a red pen with a thickness of 5 pixels. The resulting polygon will be thicker and more noticeable than the previous example. Package Library: This method is part of the System.Drawing namespace, which is included in the .NET Framework Class Library. Therefore, this method is included in the System.Drawing.dll assembly.