var
  g:TGPGraphics;
  p:TGPPen;
  sb:TGPSolidBrush;
  pts:array[0..4] of TGPPoint;
begin
  g:=TGPGraphics.Create(Canvas.Handle);
  g.Clear(aclWhite);

  p:=TGPPen.Create(aclRed,2);
  sb:=TGPSolidBrush.Create(aclBlack);

  pts[0]:=MakePoint(50,10);
  pts[1]:=MakePoint(200,10);
  pts[2]:=MakePoint(250,60);
  pts[3]:=MakePoint(200,110);
  pts[4]:=MakePoint(50,110);

  g.DrawPolygon(p,PGPPoint(@pts),Length(pts));{第二个参数是指针类型, 需亚转换}
  g.FillPolygon(sb,pgppoint(@pts),Length(pts));{第三个参数是顶点数}

  sb.Free;
  p.Free;
  g.Free;
end;
posted on 2010-12-08 17:41  巅枫  阅读(418)  评论(0编辑  收藏  举报