uses GdiPlus;

procedure TForm1.FormPaint(Sender: TObject);
var
  Graphics: IGPGraphics;
  BlackPen, GreenPen: IGPPen;
  Rect: TGPRect;
begin
  Rect.Initialize(20, 20, 80, 80);
  Graphics := TGPGraphics.Create(Handle);
  BlackPen := TGPPen.Create($FF000000, 1.5);
  GreenPen := TGPPen.Create($FF00FF00, 10);

  //GreenPen.Alignment := PenAlignmentCenter; //这是默认值
  Graphics.DrawRectangle(GreenPen, Rect);
  Graphics.DrawRectangle(BlackPen, Rect);

  Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
  GreenPen.Alignment := PenAlignmentInset;
  Graphics.DrawRectangle(GreenPen, Rect);
  Graphics.DrawRectangle(BlackPen, Rect);
end;

posted on 2009-12-16 00:00  万一  阅读(1600)  评论(0编辑  收藏  举报