随笔 - 2146  文章 - 97 评论 - 11759 trackbacks - 253




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 万一 阅读(...) 评论(...) 编辑 收藏