Author Topic: GDI+: GdipSetPenLineJoin  (Read 3163 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
GDI+: GdipSetPenLineJoin
« on: October 04, 2008, 01:01:10 AM »

The following example creates a Pen object, sets the line join style, and draws a rectangle. The code then resets the line join style and draws a second rectangle.

C++

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

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

   // Set the join style, and draw a rectangle.
   pen.SetLineJoin(LineJoinRound);
   graphics.DrawRectangle(&pen, 20, 20, 150, 100);

   // Reset the join style, and draw a second rectangle.
   pen.SetLineJoin(LineJoinBevel);
   graphics.DrawRectangle(&pen, 200, 20, 150, 100);
}

PowerBASIC

Code: [Select]
SUB GDIP_SetPenLineJoin (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, 255, 0, 0), 15, %UnitWorld, pPen)

   ' // Set the join style, and draw a rectangle.
   hStatus = GdipSetPenLineJoin(pPen, %LineJoinRound)
   hStatus = GdipDrawRectangleI(pGraphics, pPen, 20, 20, 150, 100)

   ' // Reset the join style, and draw a second rectangle.
   hStatus = GdipSetPenLineJoin(pPen, %LineJoinBevel)
   hStatus = GdipDrawRectangleI(pGraphics, pPen, 200, 20, 150, 100)

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

END SUB


« Last Edit: August 07, 2011, 09:06:26 PM by José Roca »