Graphics.FillPolygon(const Brush*, const PointF*, INT) method

Applies to: desktop apps only

The Graphics::FillPolygon method uses a brush to fill the interior of a polygon.

Syntax

Status FillPolygon(
  [in]  const Brush *brush,
  [in]  const PointF *points,
  [in]  INT count
);

Parameters

  • brush [in]
    Type: const Brush*

    Pointer to a Brush object that is used to paint the interior of the polygon.

  • points [in]
    Type: const PointF*

    Pointer to an array of points that make up the vertices of the polygon. The first two points in the array specify the first side of the polygon. Each additional point specifies a new side, the vertices of which include the point and the previous point. If the last point and the first point do not coincide, they specify the last side of the polygon.

  • count [in]
    Type: INT

    Integer that specifies the number of points in the points array.

Return value

Type:

Type: Status****

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Examples

The following example defines a polygon and then fills it.

VOID Example_FillPolygon3(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a SolidBrush object.
   SolidBrush blackBrush(Color(255, 0, 0, 0));

   // Create an array of PointF objects that define the polygon.
   PointF point1(100.0f, 100.0f);
   PointF point2(200.0f, 130.0f);
   PointF point3(150.0f, 200.0f);
   PointF point4(50.0f, 200.0f);
   PointF point5(0.0f, 130.0f);
   PointF points[5] = {point1, point2, point3, point4, point5};

   // Fill the polygon.
   graphics.FillPolygon(&blackBrush, points, 5);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics

Status

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012