• Welcome to Jose's Read Only Forum 2023.
 

GDI+: GdipCreateAdjustableArrowCap

Started by José Roca, June 22, 2008, 10:43:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following example creates two AdjustableArrowCap objects, pArrowCapStart and pArrowCapEnd, and sets the fill mode to TRUE. The code then creates a Pen object and assigns pArrowCapStart as the starting line cap for this Pen object and pArrowCapEnd as the ending line cap. Next, draws a line.


SUB GDIP_CreateAdjustableArrowCap (BYVAL hdc AS DWORD)

   LOCAL hStatus AS LONG
   LOCAL pGraphics AS DWORD
   LOCAL pArrowPen AS DWORD
   LOCAL pArrowCapStart AS DWORD
   LOCAL pArrowCapEnd AS DWORD
   LOCAL fillstate AS LONG

   hStatus = GdipCreateFromHDC(hdc, pGraphics)

   ' // Create an AdjustableArrowCap that is filled.
   hStatus = GdipCreateAdjustableArrowCap(10, 10, %TRUE, pArrowCapStart)
   ' // Create an AdjustableArrowCap that is not filled.
   hStatus = GdipCreateAdjustableArrowCap(15, 15, %FALSE, pArrowCapEnd)

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

   ' Assign pArrowStart as the start cap.
   hStatus = GdipSetPenCustomStartCap(pArrowPen, pArrowCapStart)
   ' Assign pArrowEnd as the end cap.
   hStatus = GdipSetPenCustomEndCap(pArrowPen, pArrowCapEnd)

   ' // Draw a line using pArrowPen.
   hStatus = GdipDrawLineI(pGraphics, pArrowPen, 0, 0, 100, 100)

   ' // Cleanup
   IF pArrowCapStart THEN GdipDeleteCustomLineCap(pArrowCapStart)
   IF pArrowCapEnd THEN GdipDeleteCustomLineCap(pArrowCapEnd)
   IF pArrowPen THEN GdipDeletePen(pArrowPen)
   IF pGraphics THEN GdipDeleteGraphics(pGraphics)

END SUB