//画曲线 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); g.Clear(aclWhite); p := TGPPen.Create(aclRed,4); pts[0]:=MakePoint(11,11); pts[1]:=MakePoint(66,66); pts[2]:=MakePoint(88,152); pts[3]:=MakePoint(111,111); pts[4]:=MakePoint(252,88); g.DrawCurve(p, PGPPoint(@pts), Length(pts), 0, 3, 0); {参数 4指定从第几个点开始; 参数 5 指示绘制几段; 参数 6 是曲度为 0 时就成了连续的直线} p.Free; g.Free; end;