I'm using a set of around 100 icons in my application, these are accessed using fixed refrence numbers and these numbers are also made available for the user to choose an icon. The three resolutions that are required are 16x16, 32x32 and 48x48. Each of these resolutions are held in a TPngImageList and I've created an 'icon library' using a TDataModule than contains these three image lists (TArtImageLibraryImageLists). A simple 'create on first use' method instantiates this TDataModule when any of its Image Lists are required. The LargeImages or somesuch property of any controls that require access to an image list are simply set by calling the required resolution function.
The problem is the load time when the program starts, which is about 1s on a fast machine. Obviously the worst culprit is the 48x48 image list but I'm wondering if there is a better load mechanism (eg using a resource file?) that will speed up things. Or is there a way I can reformat the image lists? I will still need a TImageList at runtime, e.g for my TreeView's etc.
Thanks, Brian.
var
FInstance : TArtImageLibraryImageLists;
function ArtImageLibraryImageLists : TArtImageLibraryImageLists;
begin
If not Assigned( FInstance ) then
FInstance := TArtImageLibraryImageLists.Create( nil );
Result := FInstance;
end;
function ArtIconLibraryImageList16 : TImageList;
begin
Result := ArtImageLibraryImageLists.ImageList16;
end;
function ArtIconLibraryImageList32 : TImageList;
begin
Result := ArtImageLibraryImageLists.ImageList32;
end;
function ArtIconLibraryImageList48 : TImageList;
begin
Result := ArtImageLibraryImageLists.ImageList48Shadow;
end;