unit LoadFromResourceName;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Clipbrd, ImgList;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ImageList1: TImageList;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: LoadFromResourceName
// Method: Graphics.TBitmap.LoadFromResourceName
// Method: Graphics.TBitmap.Create

// BeginCode
{
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.
}

{$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;
// EndCode
// EndExample: LoadFromResourceName
end.
