unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, TeCanvas, ExtCtrls; type TForm1 = class(TForm) ComboBox1: TComboBox; ColorBox1: TColorBox; ColorBox2: TColorBox; procedure FormCreate(Sender: TObject); procedure FormPaint(Sender: TObject); procedure ColorBox1Change(Sender: TObject); procedure ColorBox2Change(Sender: TObject); procedure ComboBox1Change(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} uses GDIPOBJ,GDIPAPI,TypInfo; procedure TForm1.ColorBox1Change(Sender: TObject); begin Repaint; end; procedure TForm1.ColorBox2Change(Sender: TObject); begin Repaint; end; procedure TForm1.ComboBox1Change(Sender: TObject); begin Repaint; end; procedure TForm1.FormCreate(Sender: TObject); var i:Integer; begin for I := 0 to Integer(HatchStyleTotal) - 1 do begin ComboBox1.Items.Add(GetEnumName(TypeInfo(hatchstyle),i)); end; ComboBox1.ItemIndex:=0; ColorBox1.ItemIndex:=16; ColorBox2.ItemIndex:=3; Self.Position:=poDesktopCenter; end; procedure TForm1.FormPaint(Sender: TObject); var g:TGPGraphics; hb:TGPHatchBrush; R:TGPRect; fcolor,bcolor:TGPColor; hbstype:HatchStyle; begin g:=TGPGraphics.Create(Canvas.Handle); g.Clear(aclWhite); R:=MakeRect(20,50,ClientWidth - 40,ClientHeight - 70); fcolor:=ColorRefToARGB(ColorBox1.Selected); bcolor:=ColorRefToARGB(ColorBox2.Selected); hbstype:=hatchstyle(ComboBox1.ItemIndex); hb:=TGPHatchBrush.Create(hbstype,fcolor,bcolor); g.FillEllipse(hb,r); hb.Free; g.Free; end; end.