1

Just updated to latest Inno Setup v.6.0.3. But now I get white borders in my TBitmapImage image. The script below worked just fine with the older version 5.

So, what's seems to be wrong with the newer version and the script I have been using for years?

Please note that I have scaled my display about 125%.

ExtractTemporaryFile(ExpandConstant( '{#BackgroundImage}' ));
BackgroundBitmapImage := TBitmapImage.Create(MainForm);
BackgroundBitmapImage.Left := 0;
BackgroundBitmapImage.Top := 50;
BackgroundBitmapImage.AutoSize := True;
BackgroundBitmapImage.Bitmap.LoadFromFile( ExpandConstant('{tmp}\{#BackgroundImage}')  );
BackgroundBitmapImage.Parent := MainForm;

enter image description here

Neither the exact size of the image fixed the problem.

ExtractTemporaryFile(ExpandConstant( '{#BackgroundImage}' ));
BackgroundBitmapImage := TBitmapImage.Create(MainForm);
BackgroundBitmapImage.Left := 0;
BackgroundBitmapImage.Top := 50;
BackgroundBitmapImage.Width := 600;
BackgroundBitmapImage.Height := 500;
BackgroundBitmapImage.AutoSize := False;
BackgroundBitmapImage.Bitmap.LoadFromFile( ExpandConstant('{tmp}\{#BackgroundImage}')  );
BackgroundBitmapImage.Parent := MainForm;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Maverick
  • 1,105
  • 12
  • 41

1 Answers1

2

The display, where your MainForm window is located, is scaled/zoomed.

When you set the .Parent, the control is rescaled to the target display. To prevent that, set the .Parent before (implicitly) setting the size.

ExtractTemporaryFile('{#BackgroundImage}');
BackgroundBitmapImage := TBitmapImage.Create(MainForm);
BackgroundBitmapImage.Parent := MainForm;
BackgroundBitmapImage.Left := 0;
BackgroundBitmapImage.Top := 50;
BackgroundBitmapImage.AutoSize := True;
BackgroundBitmapImage.Bitmap.LoadFromFile(
  ExpandConstant('{tmp}\{#BackgroundImage}'));

Note that there's no need to call ExpandConstant for '{#BackgroundImage}', as it does not contain any constant.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992