//声明:
PolyBezier(
  DC: HDC;      {设备环境句柄}
  const Points; {点数组}
  Count: DWORD  {数组元素个数}
): BOOL;

//一条贝塞尔线最少要有 4 个点 procedure TForm1.FormPaint(Sender: TObject); var ps: array[0..3] of TPoint; begin ps[0].X := 10; ps[0].Y := 50; ps[1].X := 40; ps[1].Y := 90; ps[2].X := 80; ps[2].Y := 10; ps[3].X := 110; ps[3].Y := 50; PolyBezier(Canvas.Handle, ps, 4); Ellipse(Canvas.Handle, ps[0].X, ps[0].Y, ps[0].X+4, ps[0].Y+4); Ellipse(Canvas.Handle, ps[1].X, ps[1].Y, ps[1].X+4, ps[1].Y+4); Ellipse(Canvas.Handle, ps[2].X, ps[2].Y, ps[2].X+4, ps[2].Y+4); Ellipse(Canvas.Handle, ps[3].X, ps[3].Y, ps[3].X+4, ps[3].Y+4); end;
//效果图:

//连续的贝塞尔线会把前一个终止点当作起始点
procedure TForm1.FormPaint(Sender: TObject);
var
  ps: array[0..6] of TPoint;
begin
  ps[0].X := 10;
  ps[0].Y := 50;
  ps[1].X := 40;
  ps[1].Y := 90;
  ps[2].X := 80;
  ps[2].Y := 10;
  ps[3].X := 110;
  ps[3].Y := 50;
  
  ps[4].X := 140;
  ps[4].Y := 10;
  ps[5].X := 180;
  ps[5].Y := 90;
  ps[6].X := 210;
  ps[6].Y := 50;
  
  PolyBezier(Canvas.Handle, ps, 7);
end; 
//效果图:

posted on 2008-02-09 19:08  万一  阅读(3442)  评论(0编辑  收藏  举报