The following example creates a Pen object, sets the line join style, and draws a rectangle. The code then gets the line join style, creates a second pen based on the first pen, and draws a second rectangle.
C++
VOID Example_GetLineJoin(HDC hdc)
{
Graphics graphics(hdc);
// Create a pen with a round line join, and use
// that pen to draw a rectangle.
Pen pen(Color(255, 255, 0, 0), 15);
pen.SetLineJoin(LineJoinRound);
graphics.DrawRectangle(&pen, 20, 20, 200, 100);
// Get the line join for the pen.
LineJoin lineJoin = pen.GetLineJoin();
// Create another pen, and use the same line join.
Pen pen2(Color(255, 0, 255, 0), 15);
pen2.SetLineJoin(lineJoin);
// Draw a second rectangle.
graphics.DrawRectangle(&pen2, 250, 20, 200, 100);
}
PowerBASIC
SUB GDIP_GetPenLineJoin (BYVAL hdc AS DWORD)
LOCAL hStatus AS LONG
LOCAL pGraphics AS DWORD
LOCAL pPen AS DWORD
LOCAL pPen2 AS DWORD
hStatus = GdipCreateFromHDC(hdc, pGraphics)
' // Create a pen with a round line join, and use
' // that pen to draw a rectangle.
hStatus = GdipCreatePen1(GDIP_ARGB(255, 255, 0, 0), 15, %UnitWorld, pPen)
hStatus = GdipSetPenLineJoin(pPen, %LineJoinRound)
hStatus = GdipDrawRectangleI(pGraphics, pPen, 20, 20, 200, 100)
' // Get the line join for the pen.
LOCAL lineJoin AS LONG
hStatus = GdipGetPenLineJoin(pPen, lineJoin)
' // Create another pen, and use the same line join.
hStatus = GdipCreatePen1(GDIP_ARGB(255, 0, 255, 0), 15, %UnitWorld, pPen2)
hStatus = GdipSetPenLineJoin(pPen2, lineJoin)
' // Draw a second rectangle.
hStatus = GdipDrawRectangleI(pGraphics, pPen2, 250, 20, 200, 100)
' // Cleanup
IF pPen THEN GdipDeletePen(pPen)
IF pPen2 THEN GdipDeletePen(pPen2)
IF pGraphics THEN GdipDeleteGraphics(pGraphics)
END SUB
(http://www.jose.it-berater.org/captures/GdipGetPenLineJoin.png)