unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
uses
  GDIPAPI,GDIPOBJ,TypInfo;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  Repaint;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  i:Integer;
begin
  for I := 0 to 4 do
  begin
    ComboBox1.Items.Add(GetEnumName(TypeInfo(TWrapmode),i));
  end;
  ComboBox1.ItemIndex:=0;
end;

procedure TForm1.FormPaint(Sender: TObject);
var
  g:TGPGraphics;
  img:TGPImage;
  r:TGPRect;
  tb:TGPTextureBrush;
begin
  Form1.DoubleBuffered:=True;
  g:=TGPGraphics.Create(Canvas.Handle);
  g.Clear(aclWhite);
  r:=MakeRect(ClientRect);
  img:=TGPImage.Create('d:\mm.jpg');
  tb:=TGPTextureBrush.Create(img);
  tb.SetWrapMode(TWrapmode(ComboBox1.ItemIndex));

  g.FillRectangle(tb,r);

  tb.Free;
  img.Free;
  g.Free;
end;

end.

posted on 2010-12-31 11:04  巅枫  阅读(319)  评论(0编辑  收藏  举报