//多边形描边与填充
var
g: TGPGraphics;
p: TGPPen;
sb: TGPSolidBrush;
pts: array[0..4] of TGPPoint;
begin
g := TGPGraphics.Create(Canvas.Handle);
sb := TGPSolidBrush.Create(MakeColor(255,255,255));
p := TGPPen.Create(MakeColor(255,0,0),4);
pts[0].X := 11; pts[0].Y := 11;
pts[1].X := 66; pts[1].Y := 111;
pts[2].X := 88; pts[2].Y := 222;
pts[3].X := 111; pts[3].Y := 88;
pts[4].X := 222; pts[4].Y := 66;
g.DrawPolygon(p, PGPPoint(@pts), Length(pts)); {第二个参数是指针类型, 需亚转换}
g.FillPolygon(sb, PGPPoint(@pts), Length(pts)); {第三个参数是顶点数}
p.Free;
sb.Free;
g.Free;
end;
时间: 2024-12-24 21:20:32