BitmapDataPath example for C++ Builder

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.

void __fastcall TForm1::Button1Click(TObject* Sender)
{
   /* Start the asynchronous load. */
   Lead1->BitmapDataPath = "http://www.leadtools.com/images/newheadr.GIF";
}

void __fastcall TForm1::Lead1ReadyStateChanged(TObject *Sender, TReadyState ReadyState)
{
   /* Paint the image when loading is complete. */
   if(ReadyState == rsComplete)
   {
      Lead1->AutoSetRects = True;
      Lead1->PaintSizeMode = smFit;
      Lead1->ForceRepaint();
   }
}