inno-setuppascalscript

How can I change the Inno Setup 'SelectDirBitmapImage' in Pascal script?


I'm trying to change the SelectDirBitmapImage using the Pascal code from Display image in top panel of Inno Setup wizard, but I'm having no luck.

I tried doing:

procedure LoadSelectDirAndGroupImages();
var
  BitmapImage: TBitmapImage;
begin
  ExtractTemporaryFile('bitmap-test5.bmp');
  BitmapImage := TBitmapImage.Create(WizardForm);
  BitmapImage.Parent := WizardForm.SelectDirBitmapImage;
  BitmapImage.Width := WizardForm.SelectDirBitmapImage.Width;
  BitmapImage.Height := WizardForm.SelectDirBitmapImage.Height;
  BitmapImage.Stretch := True;
  BitmapImage.AutoSize := False;
  BitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\bitmap-test5.bmp'));
end;

But it keeps coming back as "Type mismatch". Any idea on what's going wrong?


Solution

  • Just load the image to SelectDirBitmapImage:

    procedure InitializeWizard();
    var
      BitmapFileName: string;
      BitmapPath: string;
    begin
      BitmapFileName := 'bitmap-test5.bmp';
      ExtractTemporaryFile(BitmapFileName); 
      BitmapPath := ExpandConstant('{tmp}\' + BitmapFileName);
      WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(BitmapPath);
    end;