再学 GDI+[46]: 路径 - Create、FillPath、DrawPath

本例效果图:

再学 GDI+[46]: 路径 - Create、FillPath、DrawPath

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.


 
   

你可能感兴趣的:(create)