7

我希望 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;

图像示例

设置屏幕截图

4

1 回答 1

5

通过将您的 a 设置为Parent您要告诉的,您希望该面板成为整个向导表单的直接子级。您必须将属性更改为您希望该面板出现在其上的页面表面。BtnPanelWizardFormBtnPanel.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;
于 2012-10-17T17:27:21.043 回答