Learn to read the documentation. The note says it all. I already wrote that you invented the wheel in an array. Now you again that it invents. It's time to read and not poke your finger into the sky.
way 1
procedure TSecondForm.Button1Click(Sender: TObject);
var
bmp: TBitmap;
idx: Integer;
begin
bmp := TBitmap.Create;
try
for idx := 0 to ImageList.Count - 1 do
begin
ImageList.GetBitmap(idx,bmp);
Canvas.Draw(0,idx*bmp.Height,bmp);
end;
finally
bmp.Free;
end;
end;
way 2
procedure TSecondForm.Button2Click(Sender: TObject);
var
idx: Integer;
begin
for idx := 0 to imageList.Count - 1 do
ImageList.Draw(Canvas,0,idx*ImageList.Height,idx);
end;
I would have done something like this code:
procedure TSecondForm.Button3Click(Sender: TObject);
var
bmp: TBitmap;
idx,i: Integer;
begin
bmp := TBitmap.Create;
try
i := 0;
for idx := 0 to ComponentCount-1 do
if (Components[idx] is TImage) then
begin
ImageList.GetBitmap(i,bmp);
(Components[idx] as TImage).Picture.Assign(bmp);
Inc(i);
end;
finally
bmp.Free;
end;
end;