Главная страница | назад





Article #17385: TBitmap and externally linked resource file?

 Question and Answer Database
FAQ2385C.txt TBitmap and externally linked resource file?
Category :VCL
Platform :All
Product :C++Builder 3.x
Question:
Is there a good example of using the TBitmap::LoadFromResourceName()
and TBitmap::LoadFromResourceID() method using an externally
linked resource file?
Answer:
The following example demonstrates loading a bitmap from an
externally linked resource file. Note that the resource file must have
a different name than any form or unit in your program.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap* bmp = new Graphics::TBitmap();
//if you use resource names
bmp->LoadFromResourceName((int)HInstance, "MYBITMAP");
// or //
// if you use resource id's
bmp->LoadFromResourceID((int)HInstance, 1);
Canvas->Draw(100, 100, bmp);
bmp->Free();
}
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99