The following example defines a polygon and fills it.
C++
VOID Example_FillClosedCurve4(HDC hdc)
{
Graphics graphics(hdc);
//Create a SolidBrush object.
SolidBrush blackBrush(Color(255, 0, 0, 0));
//Create an array of PointF objects.
PointF point1(100.0f, 100.0f);
PointF point2(200.0f, 50.0f);
PointF point3(250.0f, 200.0f);
PointF point4(50.0f, 150.0f);
PointF points[4] = {point1, point2, point3, point4};
//Fill the curve.
graphics.FillClosedCurve(&blackBrush, points, 4, FillModeAlternate, 1.0);
}
PowerBASIC
SUB GDIP_FillClosedCurve2 (BYVAL hdc AS DWORD)
LOCAL hStatus AS LONG
LOCAL pGraphics AS DWORD
LOCAL pBrush AS DWORD
DIM pt(3) AS POINTF
hStatus = GdipCreateFromHDC(hdc, pGraphics)
' // Create a SolidBrush
hStatus = GdipCreateSolidFill(GDIP_ARGB(255, 0, 0, 0), pBrush)
' // Create an array of PointF objects.
pt(0).x = 100.0! : pt(0).y = 100.0!
pt(1).x = 200.0! : pt(1).y = 50.0!
pt(2).x = 250.0! : pt(2).y = 200.0!
pt(3).x = 50.0! : pt(3).y = 150.0!
' // Fill the curve.
hStatus = GdipFillClosedCurve2(pGraphics, pBrush, pt(0), 4, 1.0, %FillModeALternate)
' // Cleanup
IF pBrush THEN GdipDeleteBrush(pBrush)
IF pGraphics THEN GdipDeleteGraphics(pGraphics)
END SUB
(http://www.jose.it-berater.org/captures/GdipFillClosedCurve2.png)