• Welcome to Jose's Read Only Forum 2023.
 

GDI+: GdipDrawArc

Started by José Roca, June 23, 2008, 05:00:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following example draws a 90-degree arc.

C++


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

   // Set up the arc.
   Pen redPen(Color(255, 255, 0, 0), 3);
   REAL x = 0;
   REAL y = 0;
   REAL width = 200.0f;
   REAL height = 100.0f;
   REAL startAngle = 0.0f;
   REAL sweepAngle = 90.0f;

   // Draw the arc.
   graphics.DrawArc(&redPen, x, y, width, height, startAngle, sweepAngle);
}


PowerBASIC


SUB GDIP_DrawArc (BYVAL hdc AS DWORD)

   LOCAL hStatus AS LONG
   LOCAL pGraphics AS DWORD
   LOCAL pPen AS DWORD

   hStatus = GdipCreateFromHDC(hdc, pGraphics)

   ' // Create a red Pen
   hStatus = GdipCreatePen1(GDIP_ARGB(255, 255, 0, 0), 1.0!, %UnitWorld, pPen)

   ' // Draw the arc
   hStatus = GdipDrawArc(pGraphics, pPen, 0, 0, 200, 100, 0, 90)

   ' // Cleanup
   IF pPen THEN GdipDeletePen(pPen)
   IF pGraphics THEN GdipDeleteGraphics(pGraphics)

END SUB