It works for me if i do the following:
a) Delete all indexes and items:
Code:
imgLst.Clear;
imgLst.Items.Clear;
😎 Add the amount of items i want to be in the list with a dummy-picture:
Code:
for i:=0 to sl.count-1 do
begin
with TsImgListItem(imgLstBlocks.Items.Add) do
begin
ImageFormat := ifPNG;
PixelFormat := pf32bit;
ImgData.LoadFromFile(dummy);
end;
end;
c) Delete all indexes and items again:
Code:
imgLst.Clear;
imgLst.Items.Clear;
d) Now i can load my images into the list and everything works as expected.
I found something funny.
1) Drop a imagelist onto your form.
2) Load some icons in designtime to the list, say 5.
3) Try to delete and load more then 5 icons at runtime, lets say 10.
4) The last step wont work. But you can see that at least 5 icons were loaded, the last 5 icons
you tried loading are missing.
That lead to the steps a) to c) i mentioned above.