RAD Studio VCL Reference
|
Instantiates a bitmap object.
constructor Create; override;
virtual __fastcall TBitmap();
Call Create to instantiate a bitmap object at runtime. Create is also called automatically when a bitmap image is loaded into a TImage.
Create allocates memory for a bitmap object, and calls the inherited Create. Then it creates a TBitmapImage as the internal image that represents the bitmap.
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;
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|