Skip to main content

PdfGraphics.FillPolygon(Brush, PointF[]) Method

Fills the interior of a polygon specified by array points.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.2.Drawing.dll

NuGet Package: DevExpress.Pdf.Drawing


public void FillPolygon(
    Brush brush,
    PointF[] points


Name Type Description
brush Brush

A Brush object that specifies the brush used to fill the polygon.

points PointF[]

An array of PointF structures that specify the polygon vertices (in world coordinate system).


This method fills the polygon interior with a brush. The points parameter specifies the polygon vertices.

To draw a shape on the PDF page, use one of the following methods:

PdfGraphics.AddToPageForeground, PdfGraphics.AddToPageBackground
These methods allow you to draw content on an existing page.
Draws content on a new page.

The code sample below fills a polygon with the specified brush.

Fill a Polygon

using DevExpress.Pdf;
using System.Drawing;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
    PdfPage page = processor.AddNewPage(PdfPaperSize.A4);
        using (PdfGraphics graphics = processor.CreateGraphics())
            // Create a point array.
            PointF[] points = new PointF[] 
                new PointF(50, 50), 
                new PointF(200, 10), 
                new PointF(450, 150), 
                new PointF(500, 200), 
                new PointF(520, 350), 
                new PointF(570, 650), 
                new PointF(500, 700) 

            // Fill a polygon.
            using (var brush = new SolidBrush(Color.Blue))
                graphics.FillPolygon(brush, points);

            // Add graphics content to the document page.
            graphics.AddToPageForeground(page, 72, 72);
See Also