BitmapDataPath example for Delphi

This example shows how to load an image from the Internet. It uses the BitmapDataPath property to start the asynchronous load; then uses the OnReadyStateChanged event to paint the image when loading is complete.

procedure TForm1.Button1Click(Sender: TObject);
begin
   { Start the asynchronous load. }
   Lead1.BitmapDataPath := 'http://www.leadtools.com/images/newheadr.GIF'; 
end;

procedure TForm1.Lead1ReadyStateChanged(Sender: TObject; ReadyState: TReadyState);
begin
   { Paint the image when loading is complete. }
   if ReadyState = rsComplete then
   begin
      Lead1.AutoSetRects := True;
      Lead1.PaintSizeMode := smFit;
      Lead1.ForceRepaint;
   end;
end;.