【问题标题】:TBitmapImage is rendered larger than its size on scaled display in Inno Setup 6TBitmapImage 在 Inno Setup 6 中的缩放显示上呈现大于其大小
【发布时间】:2020-02-10 09:56:07
【问题描述】:

刚刚更新到最新的 Inno Setup v.6.0.3。但现在我的TBitmapImage 图像中有白色边框。下面的脚本在旧版本 5 上运行良好。

那么,我使用多年的新版本和脚本似乎有什么问题?

请注意,我已将显示缩放了大约 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;

图片的确切尺寸都不能解决问题。

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;

【问题讨论】:

    标签: windows image installation inno-setup pascalscript


    【解决方案1】:

    MainForm 窗口所在的显示屏已缩放/缩放。

    当您设置.Parent 时,控件将重新缩放到目标显示器。为防止这种情况发生,请在(隐式)设置大小之前设置.Parent

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

    请注意,'{#BackgroundImage}' 无需调用ExpandConstant,因为它是does not contain any constant

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多