• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

GDI+: GdipSetPenLineJoin

Started by José Roca, October 04, 2008, 01:01:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



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++


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


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