我正在尝试使用
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;
但它不断返回“类型不匹配”。知道出了什么问题吗?
————编辑————
这是有效的 Pascal 脚本:
[Files]
Source: "bitmap-test6.bmp"; Flags: dontcopy
[Code]
procedure InitializeWizard();
var
BitmapFileName: string;
BitmapPath: string;
begin
BitmapFileName := 'bitmap-test6.bmp';
ExtractTemporaryFile(BitmapFileName);
BitmapPath := ExpandConstant('{tmp}\' + BitmapFileName);
WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(BitmapPath);
end;
只需将图像加载到
SelectDirBitmapImage
:
var
BitmapFileName: string;
BitmapPath: string;
begin
BitmapFileName := 'bitmap-test5.bmp';
ExtractTemporaryFile(BitmapFileName);
BitmapPath := ExpandConstant('{tmp}\' + BitmapFileName);
WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(BitmapPath);
end;