unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ImgList, ExtCtrls;
type
TForm1 =
class(TForm)
Image1: TImage;
ImageList1: TImageList;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
ImgIndex: integer;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var bmp: TBitmap;
begin
if ImageList1.Count > 0
then
begin
if (ImgIndex < Pred(ImageList1.Count))
then
inc(ImgIndex)
else
ImgIndex := 0;
bmp := TBitmap.Create;
try
ImageList1.GetBitmap(ImgIndex,bmp);
Image1.Picture.Bitmap.Assign(bmp);
finally
bmp.Free;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ImgIndex := 0;
end;
end.