0

I've added a BitmapImage to the wpSelectDir page like this:

[Setup]
WizardStyle=modern

[Code]
function CreateBitmapImage(AParent: TWizardPage): TBitmapImage;
begin
  Result := TBitmapImage.Create(WizardForm);
  with Result do
    begin
      Parent := AParent.Surface;
      Bitmap.LoadFromFile(ExpandConstant('{tmp}\LefthandsideImg.bmp'));
      Stretch := True;
      AutoSize := False;
      Center := Center;
      Left := ScaleX(0);
      Top := ScaleY(0); 
    end;
end;

procedure SetSelectDirPageProps;
begin
  biLeftSideImage := CreateBitmapImage(PageFromID(wpSelectDir));
  WizardForm.SelectDirBitmapImage.Left := biLeftSideImage.Left + biLeftSideImage.Width + ScaleX(10);
  WizardForm.SelectDirLabel.Left := WizardForm.SelectDirBitmapImage.Left + WizardForm.SelectDirBitmapImage.Width + ScaleX(12);
  WizardForm.SelectDirLabel.Width := WizardForm.InnerNotebook.Width - WizardForm.SelectDirLabel.Left;
  WizardForm.SelectDirLabel.Autosize := True;
  WizardForm.SelectDirBrowseLabel.Left :=  WizardForm.SelectDirBitmapImage.Left;
  WizardForm.SelectDirBrowseLabel.Width := WizardForm.InnerNotebook.Width - WizardForm.SelectDirBrowseLabel.Left;
  WizardForm.SelectDirBrowseLabel.Autosize := True;
  WizardForm.DirEdit.Left :=  WizardForm.SelectDirBitmapImage.Left;
  WizardForm.DirEdit.Width := WizardForm.DirEdit.Width - ScaleX(150);
  WizardForm.DirBrowseButton.Left :=  WizardForm.DirEdit.Left + WizardForm.DirEdit.Width + ScaleX(10);
  WizardForm.DiskSpaceLabel.Left := WizardForm.DirEdit.Left;
  WizardForm.DiskSpaceLabel.Width := WizardForm.InnerNotebook.Width - WizardForm.DiskSpaceLabel.Left;
  WizardForm.DiskSpaceLabel.Top := WizardForm.InnerNotebook.Height - 2 *  WizardForm.DiskSpaceLabel.Height;
  WizardForm.DiskSpaceLabel.Autosize := True; 
end;

procedure InitializeWizard;
begin
  SetSelectDirPageProps;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
    wpSelectDir:
      begin
        biLeftSideImage.Visible := True;
        WizardForm.InnerNotebook.Left := ScaleX(10);      
        WizardForm.InnerNotebook.Width:= INNER_NOTEBOOK_WIDTH + 2 * INNER_NOTEBOOK_LEFT - WizardForm.InnerNotebook.Left;  
        WizardForm.InnerNotebook.Top := WizardForm.MainPanel.Top + WizardForm.MainPanel.Height + ScaleY(10);  
      end
    else
      begin
        biLeftSideImage.Visible := False;
        WizardForm.InnerNotebook.Left := INNER_NOTEBOOK_LEFT;
        WizardForm.InnerNotebook.Width := INNER_NOTEBOOK_WIDTH;
        WizardForm.InnerNotebook.Top := INNER_NOTEBOOK_TOP;
      end; 
  end;
end;

For wpWelcome page the BitmapImage is resized correctly: enter image description here

But for wpSelectDir page it looks like this: enter image description here

I've also tried setting Autosize to True but nothing changed.

What am I doing wrong here?

JConstantine
  • 1,020
  • 7
  • 19
  • @MartinPrikryl Yes, I do know that link, but I can't see how it can help me. The scaling works fine for `wpWelcome` page and does not work for `wpSelectDir`. – JConstantine Dec 30 '20 at 10:10
  • @MartinPrikryl Looks like I just have to set the correct anchors. – JConstantine Dec 30 '20 at 13:19
  • 1
    Welcome page (and other standard pages): *"Inno Setup can automatically select the best version of the image since 5.6. Just list your versions of the images in the `WizardImageFile` and `WizardSmallImageFile`"* – On the contrary: *" when you have additional custom images in the wizard, you would have to select the images programatically"* – Anchors are not a solution. They resize with the form. But you need to resize proportionally. – Martin Prikryl Dec 30 '20 at 16:49

0 Answers0