Preload images (Views: 100)


I have a form with a TPageControl and a number of pages. On some pages, there is a TImage showing a JPEG picture. I want these images to be loaded when the form is created, not when they are going to be drawn. The problem is that it takes a long time to change page in the page control, if the new page hasn't been shown before.


Try something like this:

procedure TForm1.FormCreate(Sender: TObject);
  if Image1.Picture.Graphic is TJPEGImage then

It tells the JPEG to decode the image right away and not on demand as it otherwise would.

<< Back to main page