You can use igpcustomlinecap and igpadjustablearrowcap to customize the line cap.
The latter inherits from the former and is used to modify the arrow caps.
Igpadjustablearrowcap test:
Igpadjustablearrowcap test code:
uses GdiPlus;procedure TForm1.FormPaint(Sender: TObject);var Graphics: IGPGraphics; Pen: IGPPen; Cap1,Cap2: IGPAdjustableArrowCap;begin Graphics := TGPGraphics.Create(Handle); Pen := TGPPen.Create($FFDC143C, 4); Cap1 := TGPAdjustableArrowCap.Create(4, 4); Cap2 := TGPAdjustableArrowCap.Create(4, 4, False); Pen.CustomStartCap := Cap1; Pen.CustomEndCap := Cap2; Graphics.DrawLine(Pen, 30, 30, 250, 30); Cap1 := TGPAdjustableArrowCap.Create(4, 8); Cap2 := TGPAdjustableArrowCap.Create(4, 8, False); Pen.CustomStartCap := Cap1; Pen.CustomEndCap := Cap2; Graphics.DrawLine(Pen, 30, 80, 250, 80);end;
Igpcustomlinecap test:
Igpcustomlinecap test code:
Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); const PTS: array [0 .. 3] of tgppoint = (X:-4; Y: 0), (X: 0; Y:-4), (X: 4; Y: 0 ), (X: 0; Y: 8); var graphics: igpgraphics; pen: igppen; path1, path2: igpgraphicspath; cap1, cap2: igpcustomlinecap; pt1, pt2: tgppoint; begin graphics: = tgpgraphics. create (handle); path1: = tgpgraphicspath. create; path1.addellipse (tgprect. create (-3,-3, 6, 6); path2: = tgpgraphicspath. create; path2.addpolygon (PTS); pt1.initialize (50, 30); pt2.initialize (50,150); pen: = tgppen. create ($ ff8b0000, 3); // cap1: = tgpcustomlinecap. create (nil, path1); cap2: = tgpcustomlinecap. create (nil, path2); pen. customstartcap: = cap1; pen. customendcap: = cap2; graphics. drawline (pen, pt1, pt2); graphics. translatetransform (pt1.x, 0); // cap1: = tgpcustomlinecap. create (nil, path1, linecapflat, 3); cap2: = tgpcustomlinecap. create (nil, path2, linecapflat, 4); pen. customstartcap: = cap1; pen. customendcap: = cap2; graphics. drawline (pen, pt1, pt2); graphics. translatetransform (pt1.x, 0); // Note: when using a fill path, the parameter requirements for the build path are odd... cap1: = tgpcustomlinecap. create (path1, nil); cap2: = tgpcustomlinecap. create (path2, nil); pen. customstartcap: = cap1; pen. customendcap: = cap2; graphics. drawline (pen, pt1, pt2); graphics. translatetransform (pt1.x, 0); // cap1: = tgpcustomlinecap. create (path1, nil); cap2: = tgpcustomlinecap. create (path2, nil); cap1.widthscale: = 0.75; cap2.widthscale: = 1.3; pen. customstartcap: = cap1; pen. customendcap: = cap2; graphics. drawline (pen, pt1, pt2); end;