WinAPI: PolylineTo - 绘制一组连续线段(更新当前位置)


//声明:

PolylineTo(

  DC: HDC;       {设备环境句柄}

  var Points;    {点数组}

  Count: Integer {数组元素个数}

): BOOL;


 
   
//如果不给 PolylineTo 指定起点, 将默认 0 点位起点 procedure TForm1.FormPaint(Sender: TObject); var ps: array[0..5] of TPoint; begin ps[0].X := 50; ps[0].Y := 50; ps[1].X := 100; ps[1].Y := 50; ps[2].X := 125; ps[2].Y := 75; ps[3].X := 100; ps[3].Y := 100; ps[4].X := 50; ps[4].Y := 100; ps[5].X := 25; ps[5].Y := 75; PolylineTo(Canvas.Handle, ps, 6); end;
//效果图:
WinAPI: PolylineTo - 绘制一组连续线段(更新当前位置)

//给 PolylineTo 指定起点

procedure TForm1.FormPaint(Sender: TObject);

var

  ps: array[0..4] of TPoint;

begin

  MoveToEx(Canvas.Handle, 50,50, nil);

  

  ps[0].X := 100;

  ps[0].Y := 50;

  ps[1].X := 125;

  ps[1].Y := 75;

  ps[2].X := 100;

  ps[2].Y := 100;

  ps[3].X := 50;

  ps[3].Y := 100;

  ps[4].X := 25;

  ps[4].Y := 75;



  PolylineTo(Canvas.Handle, ps, 5);

end; 


 
   
//效果图:
WinAPI: PolylineTo - 绘制一组连续线段(更新当前位置)

//PolylineTo 更新当前位置

procedure TForm1.FormPaint(Sender: TObject);

var

  ps: array[0..4] of TPoint;

begin

  MoveToEx(Canvas.Handle, 50,50, nil);

  

  ps[0].X := 100;

  ps[0].Y := 50;

  ps[1].X := 125;

  ps[1].Y := 75;

  ps[2].X := 100;

  ps[2].Y := 100;

  ps[3].X := 50;

  ps[3].Y := 100;

  ps[4].X := 25;

  ps[4].Y := 75;



  PolylineTo(Canvas.Handle, ps, 5);



  {PolylineTo 更新当前位置, 继续画}

  LineTo(Canvas.Handle, 50,50);

end;


 
   
//效果图:
WinAPI: PolylineTo - 绘制一组连续线段(更新当前位置)

你可能感兴趣的:(api)