title: Load bitmap from resource file to image
body: <p>how do I load an image bmp from resource file and load it into image1.Picture? I tried this:</p>
  
  <pre><code>{$R resource.res}
  procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  var
   BitMap1 : TBitMap;
  begin
    BitMap1 := TBitMap.Create;
    try
      BitMap1.LoadFromResourceName(HInstance,'down');
      Image1.Picture(BitMap1);
    finally
      BitMap1.Free;
    end;
  end;
  </code></pre>
  
  <p>but does't work. Thanks!</p>
  
  <hr>
  
  <p>I created a file. rc:</p>
  
  <pre><code>DOWN BMP DOWN.BMP 
  </code></pre>
  
  <p>and I compiled with brcc32.exe:</p>
  
  <pre><code>brcc32.exe resource.rc
  </code></pre>
  
  <p>I implemented the resource:</p>
  
  <pre><code>{$R resource.res}
  </code></pre>
  
  <p>but can not find the file bmp.</p>
  
  <hr>
  
  <p>It does not work, always an error, however I found another code:</p>
  
  <pre><code>procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  begin
     Image1.Picture.Bitmap.Handle := LoadBitmap(hInstance, 'DOWN');
  end;
  </code></pre>
  
  <p>But when I click on the image disappears, why? Thanks</p>
  
  <p>This is the code:</p>
  
  <pre><code>unit Unit1;
  
  interface
  
  uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, XPMan, ExtCtrls;
  
  type
    TForm1 = class(TForm)
      XPManifest1: TXPManifest;
      Image1: TImage;
      procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
    private
      { Private declarations }
    public
      { Public declarations }
    end;
  
  var
    Form1: TForm1;
  
  implementation
  
  {$R *.dfm}
  {$R RESOURCE.RES}
  
  procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  begin
     Image1.Picture.Bitmap.Handle := LoadBitmap(hInstance,'DOWN');
  end;
  
  end.
  </code></pre>