//繪制與填充路徑var
g: TGPGraphics;
path: TGPGraphicsPath;
p: TGPPen;
sb: TGPSolidBrush;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(MakeColor(128,255,0,0),4);
sb := TGPSolidBrush.Create(MakeColor(128,255,255,0));
path := TGPGraphicsPath.Create;
path.StartFigure;
path.AddLine(MakePoint(11,11), MakePoint(222,111));
path.AddBezier(MakePoint(11,11), MakePoint(33,111), MakePoint(66,6),MakePoint(111,111));
path.CloseFigure;
g.DrawPath(p, path);
g.FillPath(sb, path);
p.Free;
sb.Free;
path.Free;
g.Free;
end;
//路徑中的拐點結合var
g: TGPGraphics;
p: TGPPen;
path: TGPGraphicsPath;
p1,p2,p3: TGPPoint;
begin
g := TGPGraphics.Create(Canvas.Handle);
p:= TGPPen.Create(MakeColor(255, 0, 0, 255),8);
path:= TGPGraphicsPath.Create;
p1.X := 50; p1.Y := 200;
p2.X := 100; p2.Y := 200;
p3.X := 100; p3.Y := 250;
path.AddLine(p1, p2);
path.AddLine(p2, p3);
p.SetLineJoin(LineJoinBevel); {設置結合樣式}
g.DrawPath(p, path);
path.Free;
p.Free;
g.Free;
end;
路徑中的拐點結合樣式:
Delphi 微軟 說明 LineJoinBevel Bevel 指定成斜角的聯接。這將產生一個斜角。 LineJoinMiter Miter 指定斜聯接。這將產生一個銳角或切除角,具體取決於斜聯接的長度是否超過斜聯接限制。 LineJoinMiterClipped MiterClipped 指定斜聯接。這將產生一個銳角或斜角,具體取決於斜聯接的長度是否超過斜聯接限制。 LineJoinRound Round 指定圓形聯接。這將在兩條線之間產生平滑的圓弧。