随笔 - 2146  文章 - 97 评论 - 11765 trackbacks - 253

//画曲线
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;
posted on 2007-12-27 19:05 万一 阅读(...) 评论(...) 编辑 收藏