本例效果图:


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormPaint(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses GDIPOBJ, GDIPAPI;

procedure TForm1.FormPaint(Sender: TObject);
var
  g: TGPGraphics;
  path: TGPGraphicsPath;
  p: TGPPen;
  b: TGPBrush;
begin
  g := TGPGraphics.Create(Canvas.Handle);

  path := TGPGraphicsPath.Create;
  path.AddLine(10,10,110,110);
  path.AddRectangle(MakeRect(10,10,100,100));
  path.AddEllipse(MakeRect(10,10,100,100));

  p := TGPPen.Create(aclRed);
  b := TGPSolidBrush.Create(aclYellow);
  g.FillPath(b, path);
  g.DrawPath(p, path);

  b.Free;
  p.Free;
  path.Free;
  g.Free;
end;

end.

posted on 2008-06-18 01:47  万一  阅读(4076)  评论(1编辑  收藏  举报