//畫曲線var
g: TGPGraphics;
p: TGPPen;
pts: array[0..4] of TGPPoint;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(MakeColor(255,0,0),4);
pts[0].X := 11; pts[0].Y := 11;
pts[1].X := 66; pts[1].Y := 66;
pts[2].X := 88; pts[2].Y := 222;
pts[3].X := 111; pts[3].Y := 111;
pts[4].X := 222; pts[4].Y := 88;
g.DrawCurve(p, PGPPoint(@pts), Length(pts));
p.Free;
g.Free;
end;
//指定曲度var
g: TGPGraphics;
p: TGPPen;
pts: array[0..4] of TGPPoint;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(MakeColor(255,0,0),4);
pts[0].X := 11; pts[0].Y := 11;
pts[1].X := 66; pts[1].Y := 66;
pts[2].X := 88; pts[2].Y := 222;
pts[3].X := 111; pts[3].Y := 111;
pts[4].X := 222; pts[4].Y := 88;
g.DrawCurve(p, PGPPoint(@pts), Length(pts), 0.25); //指定曲度為 0.25; 默認是 0.5
p.Free;
g.Free;
end;
//繪制曲線的部分var
g: TGPGraphics;
p: TGPPen;
pts: array[0..4] of TGPPoint;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(MakeColor(255,0,0),4);
pts[0].X := 11; pts[0].Y := 11;
pts[1].X := 66; pts[1].Y := 66;
pts[2].X := 88; pts[2].Y := 222;
pts[3].X := 111; pts[3].Y := 111;
pts[4].X := 222; pts[4].Y := 88;
g.DrawCurve(p, PGPPoint(@pts), Length(pts), 1, 2, 0);
{參數 3 指定從第幾個點開始; 參數 4 指示繪制幾段; 參數 5 是曲度為 0 時就成了連續的直線}
p.Free;
g.Free;
end;