The following example draws a
GraphicsPath object.
C++
VOID Example_DrawPath(HDC hdc)
{
Graphics graphics(hdc);
// Create a GraphicsPath, and add an ellipse.
GraphicsPath ellipsePath;
ellipsePath.AddEllipse(Rect(100, 50, 200, 100));
// Create a Pen object.
Pen blackPen(Color(255, 0, 0, 0), 3);
// Draw ellipsePath.
graphics.DrawPath(&blackPen, &ellipsePath);
}
PowerBASIC
SUB GDIP_DrawPath (BYVAL hdc AS DWORD)
LOCAL hStatus AS LONG
LOCAL pGraphics AS DWORD
LOCAL pPen AS DWORD
LOCAL pEllipsePath AS DWORD
hStatus = GdipCreateFromHDC(hdc, pGraphics)
' Create a GraphicsPath object, and add an ellipse
hStatus = GdipCreatePath(%FillModeAlternate, pEllipsePath)
hStatus = GdipAddPathEllipseI(pEllipsePath, 100, 50, 200, 100)
' // Create a Pen
hStatus = GdipCreatePen1(GDIP_ARGB(255, 0, 0, 0), 3, %UnitPixel, pPen)
' // Draw ellipsePath.
hStatus = GdipDrawPath(pGraphics, pPen, pEllipsePath)
' // Cleanup
IF pEllipsePath THEN GdipDeletePath(pEllipsePath)
IF pPen THEN GdipDeletePen(pPen)
IF pGraphics THEN GdipDeleteGraphics(pGraphics)
END SUB
(http://www.jose.it-berater.org/captures/GdipDrawPath.png)