Override the maximum size of WizardSmallImage

2019-06-01 07:08发布

问题:

I'm trying to set a custom image for the WizardSmallImage of a installer I'm making, but, I have run onto a problem: the image I'm trying to use exceeds the max size for WizardSmallImage (55x58). Since I'm doing this for a friend, I can't cut/shrink his image.

So, is there any way to override this max size? I have tried to change the properties of WizardForm.WizardSmallBitmapImage manually by writing this code in the [Code] section:

procedure InitializeWizard;
begin
  WizardForm.WizardSmallBitmapImage.Stretch := false;
  WizardForm.WizardSmallBitmapImage.Width := 150
end;

But it didn't work...

If anyone could answer me, I would be really grateful!!

回答1:

When you increase Width of WizardSmallBitmapImage it overlaps right edge of the window. You have to move it to the left too.

If you need to make it too wide (150), you also need to make the labels (PageDescriptionLabel and PageNameLabel) to the left more narrow.

procedure InitializeWizard;
var Diff: Integer;
begin
    ....
    Diff := ScaleX(150) - WizardForm.WizardSmallBitmapImage.Width;
    WizardForm.WizardSmallBitmapImage.Width := 
        WizardForm.WizardSmallBitmapImage.Width + Diff
    WizardForm.WizardSmallBitmapImage.Left :=
        WizardForm.WizardSmallBitmapImage.Left - Diff;
    WizardForm.PageDescriptionLabel.Width := 
        WizardForm.PageDescriptionLabel.Width - Diff;
    WizardForm.PageNameLabel.Width := 
        WizardForm.PageNameLabel.Width - Diff;
    ...
end;