The following example draws a pie.
C++
VOID Example_DrawPie4(HDC hdc)
{
Graphics graphics(hdc);
// Create a Pen object.
Pen blackPen(Color(255, 0, 0, 0), 3);
// Define the pie.
REAL x = 0.0f;
REAL y = 0.0f;
REAL width = 200.0f;
REAL height = 100.0f;
REAL startAngle = 0.0f;
REAL sweepAngle = 45.0f;
// Draw the pie.
graphics.DrawPie(&blackPen, x, y, width, height, startAngle, sweepAngle);
}
PowerBASIC
SUB GDIP_DrawPie (BYVAL hdc AS DWORD)
LOCAL hStatus AS LONG
LOCAL pGraphics AS DWORD
LOCAL pPen AS DWORD
LOCAL x AS SINGLE
LOCAL y AS SINGLE
LOCAL nWidth AS SINGLE
LOCAL nHeight AS SINGLE
LOCAL startAngle AS SINGLE
LOCAL sweepAngle AS SINGLE
hStatus = GdipCreateFromHDC(hdc, pGraphics)
' // Create a Pen
hStatus = GdipCreatePen1(GDIP_ARGB(255,0, 0, 0), 3, %UnitPixel, pPen)
' // Define the pie.
x = 0.0!
y = 0.0!
nWidth = 200.0!
nHeight = 100.0!
startAngle = 0.0!
sweepAngle = 45.0!
' // Draw the pie
hStatus = GdipDrawPie(pGraphics, pPen, x, y, nWidth, nHeight, startAngle, sweepAngle)
' // Cleanup
IF pPen THEN GdipDeletePen(pPen)
IF pGraphics THEN GdipDeleteGraphics(pGraphics)
END SUB
(http://www.jose.it-berater.org/captures/GdipDrawPie.png)