GDI+ 学习记录(12): 矩形 - Rectangle、Rectangles

//填充与描边
var
  g: TGPGraphics;
  p: TGPPen;
  sb: TGPSolidBrush;
begin
  g := TGPGraphics.Create(Canvas.Handle);
  sb := TGPSolidBrush.Create(MakeColor(255,255,255));
  p := TGPPen.Create(MakeColor(255,0,0),6);

  g.FillRectangle(sb, 0, 0, Self.ClientWidth, Self.ClientHeight); {填充窗体矩形}
  g.DrawRectangle(p,11,11,111,111);                               {矩形描边}
  sb.SetColor(MakeColor(255,255,0));
  g.FillRectangle(sb,11,11,111,111);                              {填充矩形}

  p.Free;
  sb.Free;
  g.Free;
end;

 
 
 
 
 

 

 
  

//矩形组
var
  g: TGPGraphics;
  p: TGPPen;
  sb: TGPSolidBrush;
  rs: array[0..1] of TGPRect;
begin
  g := TGPGraphics.Create(Canvas.Handle);
  sb := TGPSolidBrush.Create(MakeColor(255,255,255));
  p := TGPPen.Create(MakeColor(255,0,0),2);

  rs[0].X := 11; rs[0].Y := 11; rs[0].Width := 88; rs[0].Height := 111;
  rs[1].X := 111; rs[1].Y := 122; rs[1].Width := 88; rs[1].Height := 111;

  g.DrawRectangles(p, PGPRect(@rs), Length(rs));
  g.FillRectangles(sb, PGPRect(@rs), Length(rs));

  p.Free;
  sb.Free;
  g.Free;
end;

 
 
 
 
 

 

 
  

你可能感兴趣的:(GDI+ 学习记录(12): 矩形 - Rectangle、Rectangles)