Form very slow to load

Hi Bruno,


We have a screen that has several grids and it takes more than 4 seconds to create the form.  After running it through a profiler it shows TAdvStringGrid.Create as something taking a lot of time.

It seems it creates an image list and populates it with Icons for every string grid and after removing the code below the load time for the form dropped to 2.2 seconds (still longer than I would like but a big improvement).  

Perhaps you could create the image list only once and all use the same instance (based on what I can see it is used for that seems safe to do).

In TAdvStringGrid.Create


  FFltrList := TImageList.Create(Self);


  Icon := TIcon.Create;
  try
    LoadIconFromRes(icon, Hinstance, 'TMSGRDSTARTSWITH');
    FFltrList.AddIcon(icon);


    LoadIconFromRes(icon, HInstance, 'TMSGRDENDSWITH');
    FFltrList.AddIcon(icon);


    LoadIconFromRes(icon, Hinstance, 'TMSGRDCONTAINS');
    FFltrList.AddIcon(icon);


    LoadIconFromRes(icon, Hinstance, 'TMSGRDNOTCONTAINS');
    FFltrList.AddIcon(icon);


    LoadIconFromRes(icon, Hinstance, 'TMSGRDEQUAL');
    FFltrList.AddIcon(icon);


    LoadIconFromRes(icon, Hinstance, 'TMSGRDNOTEQUAL');
    FFltrList.AddIcon(icon);


    LoadIconFromRes(icon, Hinstance, 'TMSGRDLARGER');
    FFltrList.AddIcon(icon);


    LoadIconFromRes(icon, Hinstance, 'TMSGRDSMALLER');
    FFltrList.AddIcon(icon);


    LoadIconFromRes(icon, Hinstance, 'TMSGRDCLEAR');
    FFltrList.AddIcon(icon);
  finally
    icon.Free;
  end;


Thanks 

Mark Jones
Today Software

Hi,


Something must have been wrong with laptop for it to be running that slowly as after reboot form loads fine (600ms).  CPU usage was appeared totally normal before reboot so no idea what could have been causing it to slow down so much...

So can probably just not worry about the original post.

Mark 

Ok, thanks for informing.