如何更改 Pascal 脚本中的“SelectDirBitmapImage”?

问题描述 投票:0回答:1

我正在尝试使用

Inno Setup 向导顶部面板中的显示图像中的 Pascal 代码来更改 
SelectDirBitmapImage,但我没有运气。

我尝试这样做:

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;

但它不断返回“类型不匹配”。知道出了什么问题吗?

*编辑⠀⠀这是从我得到的答案中添加的代码的MRE:

[Files]
Source: "bitmap-test6.bmp"; Flags: dontcopy

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

仍然是相同的默认 Shell 镜像:( Still the same default Shell image :(

inno-setup pascalscript
1个回答
1
投票

只需将图像加载到

SelectDirBitmapImage
:

var
  BitmapFileName: string;
  BitmapPath: string;
begin
  BitmapFileName := 'bitmap-test5.bmp';
  ExtractTemporaryFile(BitmapFileName); 
  BitmapPath := ExpandConstant('{tmp}\' + BitmapFileName);
  WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(BitmapPath);
end;
© www.soinside.com 2019 - 2024. All rights reserved.