Skip to content

Commit

Permalink
Don't stretch small wizard image vertically when >1 images specified.
Browse files Browse the repository at this point in the history
Previously, when multiple images were specified, the control was left at its default non-square 55x58 size, causing vertical stretching if square image sizes like 55x55 were used.

Report: https://groups.google.com/g/innosetup/c/9IB8v14MoKI
  • Loading branch information
jordanrussell authored Oct 30, 2024
1 parent 70de42e commit 4420840
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions Projects/Src/Setup.WizardForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -776,17 +776,30 @@ constructor TWizardForm.Create(AOwner: TComponent);

MainPanel.ParentBackground := False;

{ Prior to scaling the form, shrink WizardSmallBitmapImage if it's currently
larger than WizardSmallImage. This way, stretching will not occur if the
user specifies a smaller-than-default image and WizardImageStretch=yes,
except if the form has to be scaled (e.g. due to Large Fonts). }
if WizardSmallImages.Count = 1 then begin
I := WizardSmallBitmapImage.Height - TBitmap(WizardSmallImages[0]).Height;
{ Prior to scaling the form, reduce the size of the WizardSmallBitmapImage
control if appropriate:
- If the user specified a single image AND that image is not larger than
the default control size (55x58), then reduce the control size to match
the image dimensions. That avoids stretching if the user is purposely
using a smaller-than-default image and WizardImageStretch=yes.
- Otherwise, it's unclear what size/shape the user prefers for the
control. But most likely they're using square images intended to fill
the whole area, so reduce the control size to a square 55x55. }
begin
var NewWidth := TBitmap(WizardSmallImages[0]).Width;
var NewHeight := TBitmap(WizardSmallImages[0]).Height;
if (WizardSmallImages.Count > 1) or
(NewWidth > WizardSmallBitmapImage.Width) or
(NewHeight > WizardSmallBitmapImage.Height) then begin
NewWidth := 55;
NewHeight := 55;
end;
I := WizardSmallBitmapImage.Height - NewHeight;
if I > 0 then begin
WizardSmallBitmapImage.Height := WizardSmallBitmapImage.Height - I;
WizardSmallBitmapImage.Top := WizardSmallBitmapImage.Top + (I div 2);
end;
I := WizardSmallBitmapImage.Width - TBitmap(WizardSmallImages[0]).Width;
I := WizardSmallBitmapImage.Width - NewWidth;
if I > 0 then begin
WizardSmallBitmapImage.Width := WizardSmallBitmapImage.Width - I;
WizardSmallBitmapImage.Left := WizardSmallBitmapImage.Left + (I div 2);
Expand Down

0 comments on commit 4420840

Please sign in to comment.