Date added/modified: 12 Jan 2001
I was alarmed when a user of my application reported that he can't see icons on the toolbar. Then, I searched the web to see whether it was a known problem. I got some hints and it was apparent that it was rather a problem of a Microsoft DLL in that the format of the file in which imagelist bitmaps are kept, changes between DLLs and this problem occurs. So, if you are using TImageList and TToolBar, some of your users will see this problem too. Moreover, I suspect the problem would occur for non-toolbar uses of TImageList as well.
Finally, after much experimentation, I found the following solution. Note that it has been a while since I did that. So, if you follow these steps and see that something doesn't work, please correct me.
First, I used ImageList editor to export all the images in a single bitmap file using the Export button. Then, I removed the images from the imagelist. Then, I included the bitmap in a resource file and included it in the unit that uses it. The code dynamically loads the bitmap into TImageList. That works and solves the problem. Here is the code:
...
{$R images.res}
...
procedure TMainWin.FormCreate(Sender: TObject);
var
...
B: TBitmap;
begin
B := TBitmap.Create;
try
B.LoadFromResourceName(hInstance, 'toolbar');
toolimages.AddMasked(B, B.TransparentColor);
finally
B.Free;
end;