Author Topic: GDI+: GdipSetPenDashCap197819  (Read 2821 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
GDI+: GdipSetPenDashCap197819
« on: July 02, 2008, 07:06:05 PM »

The following example creates a Pen object, sets the dash style and the dash cap, and draws a dashed line.

C++

Code: [Select]
VOID Example_SetCustomStartCap(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a pen.
   Pen pen(Color(255, 0, 0, 255), 20);

   // Set the dash style for the pen.
   pen.SetDashStyle(DashStyleDash);

   // Set a triangular dash cap for the pen.
   pen.SetDashCap(DashCapTriangle);

   // Draw a line using the pen.
   graphics.DrawLine(&pen, 20, 20, 200, 100);
}

PowerBASIC

Code: [Select]
SUB GDIP_SetPenDashCap197819 (BYVAL hdc AS DWORD)

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

   hStatus = GdipCreateFromHDC(hdc, pGraphics)

   ' // Create a pen.
   hStatus = GdipCreatePen1(GDIP_ARGB(255, 0, 0, 255), 20, %UnitWorld, pPen)

   ' // Set the dash style for the pen.
   HStatus = GdipSetPenDashStyle(pPen, %DashStyleDash)

   ' // Set a triangular dash cap for the pen.
   hStatus = GdipSetPenDashCap197819(pPen, %DashCapTriangle)

   ' // Draw a line using the pen.
   hStatus = GdipDrawLineI(pGraphics, pPen, 20, 20, 200, 100)

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

END SUB


« Last Edit: August 07, 2011, 09:13:18 PM by José Roca »