Graphics.FillPolygon(const Brush*, const Point*, INT, FillMode) 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 Point *points,
[in] INT count,
[in] FillMode fillMode
);
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 Point*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: INTInteger that specifies the number of points in the points array.
fillMode [in]
Type: FillModeElement of the FillMode enumeration that specifies how to fill a closed area that is within another closed area and that is created when the curve or path passes over itself.
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 fills it.
VOID Example_FillPolygon2(HDC hdc)
{
Graphics graphics(hdc);
// Create a SolidBrush object.
SolidBrush blackBrush(Color(255, 0, 0, 0));
// Create an array of Point objects that define the polygon.
Point point1(100, 100);
Point point2(200, 130);
Point point3(150, 200);
Point point4(50, 200);
Point point5(0, 130);
Point points[5] = {point1, point2, point3, point4, point5};
// Fill the polygon.
graphics.FillPolygon(&blackBrush, points, 5, FillModeAlternate);
}
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
Send comments about this topic to Microsoft
Build date: 3/6/2012