inno setup bmp图像出现在一个页面上

Mar*_*cio 7 inno-setup

我希望bmp图像出现在单个页面"selectadditionaltasks"上,但它出现在所有页面上.我究竟做错了什么?

procedure LogoOnClick(Sender: TObject);
var ResCode: Integer;
begin
end;
procedure LogoWizard();

var
  BtnPanel: TPanel;
  BtnImage: TBitmapImage;
begin
  ExtractTemporaryFile('Logo.bmp')

  BtnPanel:=TPanel.Create(WizardForm)
  with BtnPanel do begin
    Left:=40
    Top:=250
    Width:=455
    Height:=42
    Cursor:=crHand
    OnClick:=@logoOnClick
    Parent:=WizardForm
  end
  BtnImage:=TBitmapImage.Create(WizardForm)
  with BtnImage do begin
    AutoSize:=True;
    Enabled:=False;
    Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\Logo.bmp')
    Parent:=BtnPanel
  end
end;
procedure InitializeWizard();
begin
  LogoWizard();
end;
Run Code Online (Sandbox Code Playgroud)

图片示例

设置截图

TLa*_*ama 5

通过设置Parent你的BtnPanelWizardForm你讲,你想要的面板是整个向导形式的直接子.您必须将BtnPanel.Parent属性更改为要在其上显示该面板的页面.

由于您希望图像显示在" 选择其他任务"向导页面上,我建议的最好方法是仅使用没有底层面板的图像并调整TasksList检查列表框的大小,默认情况下也会覆盖页面的底部区域,其中你想放置你的形象.这就是以下脚本.您也可以遵循commented version以下脚本:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Files]
Source: "Logo.bmp"; Flags: dontcopy

[Tasks]
Name: associate; Description: "&Associate files"; Flags: unchecked
Name: desktopicon; Description: "Create a &desktop icon"; Flags: unchecked

[Code]
procedure LogoOnClick(Sender: TObject);
begin
  MsgBox('Hello!', mbInformation, MB_OK);
end;

procedure InitializeWizard;
var
  BtnImage: TBitmapImage;
begin
  ExtractTemporaryFile('Logo.bmp');

  BtnImage := TBitmapImage.Create(WizardForm);
  with BtnImage do 
  begin
    Parent := WizardForm.SelectTasksPage;
    Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\Logo.bmp');
    AutoSize := True;
    Left := 0;
    Top := WizardForm.SelectTasksPage.Top + WizardForm.SelectTasksPage.Height - 
      Height - 8;
    Cursor := crHand;
    OnClick := @LogoOnClick;            
  end;
  WizardForm.TasksList.Height :=
    WizardForm.TasksList.Height - BtnImage.Height - 8;
end;
Run Code Online (Sandbox Code Playgroud)