Fills the inside of a polygon with vertices specified using an array of points.
Syntax

[C#]

void FillPolygon(Brush brush, Point[] pts);
void FillPolygon(Brush brush, Point[] pts, FillMode mode);
void FillPolygon(Brush brush, PointF[] pts);
void FillPolygon(Brush brush, PointF[] pts, FillMode mode);

[Visual Basic]

Sub FillPolygon(brush As Brush, pts As Point())
Sub FillPolygon(brush As Brush, pts As Point(), mode As FillMode)
Sub FillPolygon(brush As Brush, pts As PointF())
Sub FillPolygon(brush As Brush, pts As PointF(), mode As FillMode)
Params
Name Description
brush The brush to use for the fill.
pts Array of points representing the corners of the polygon.
mode The fill mode to use.
Notes

None.

Example

Here we paint and draw a patterned circle.

[C#]PointF[] points = new PointF[127];
for (int i = 0; i <= 126; i++) {
  double x = (200 * Math.Cos(i / 20.0)) + 250;
  double y = (200 * Math.Sin(i / 20.0)) + 250;
  points[i] = new PointF(x, y);
}
using (Bitmap bm = new Bitmap(500, 500)) {
  using (Graphics graphics = Graphics.FromImage(bm)) {
    using (Bitmap pattern = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/jeremy-bishop-_CFv3bntQlQ-unsplash.jpg"))) {
      TextureBrush texture = new TextureBrush(pattern);
      graphics.FillPolygon(texture, points);
    }
  }
  bm.Save(Server.MapPath("IG8_Graphics_FillPolygon.png"));
}



jeremy-bishop-_CFv3bntQlQ-unsplash.jpg


IG8_Graphics_FillPolygon.png