//多邊形描邊與填充
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;