RAD Studio VCL Reference
|
Loads a bitmap resource into the bitmap object.
procedure LoadFromResourceName(Instance: THandle; const ResName: String);
__fastcall LoadFromResourceName(THandle Instance, const AnsiString ResName);
LoadFromResourceName loads the specified bitmap resource along with palette information from a module's executable file.
Instance is the handle of the module that contains the resource.
ResName is the name of the resource to load.
C++ Examples:
/* This example requires a resource file in the sources directory. */ #pragma resource "extrares.res" void __fastcall TForm1::Button1Click(TObject *Sender) { Graphics::TBitmap *Bitmap1 = new Graphics::TBitmap(); try { Bitmap1->LoadFromResourceName((int)HInstance, "Live"); Canvas->Draw(12,12,Bitmap1); } catch (...) { MessageBeep(0); } delete Bitmap1; }
Delphi Examples:
{ LoadFromResourceName example } {$R extrares.res} procedure TForm1.Button1Click(Sender: TObject); var BitMap1 : TBitMap; begin BitMap1 := TBitMap.Create; try BitMap1.LoadFromResourceName(HInstance,'Live'); Canvas.Draw(12,12,BitMap1); finally BitMap1.Free; end; end;
HInstance
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|