LoadFromResourceName (Delphi)
Description
This example demonstrates how to access a resource file. Specify the resource file with the $R directive below. The RC file associated with the resource file relates the resource name with the bitmap.
Code
{$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);
BitMap1.LoadFromResourceName(HInstance,'Dead');
Canvas.Draw(12,102,BitMap1);
finally
BitMap1.Free;
end;
end;
Uses
- Vcl.Graphics.TBitmap.LoadFromResourceName ( fr | de | ja )
- Vcl.Graphics.TBitmap.Create ( fr | de | ja )