unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ImgList, StdCtrls, ExtCtrls;
type
TForm2 =
class(TForm)
Image1: TImage;
ComboBox1: TComboBox;
ImageList1: TImageList;
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure getimage(imglst:TimageList; Id:Integer;bitmap:tbitmap);
var bit : TBitmap;
begin
bit := TBitmap.Create;
try
imglst.GetBitmap(id, Bit);
bitmap.Assign(bit);
finally
FreeAndNil(Bit);
end;
end;
procedure TForm2.ComboBox1Change(Sender: TObject);
var bitmap : tbitmap;
begin
bitmap := tbitmap.create;
getimage(ImageList1,0,bitmap);
Image1.picture.bitmap.assign(bitmap);
freeandnil(bitmap);
end;
end.