繁体   English   中英

在 Inno Setup 6 中,TBitmapImage 在缩放显示上呈现得大于其大小

[英]TBitmapImage is rendered larger than its size on scaled display in Inno Setup 6

刚刚更新到最新的 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;

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

当您设置.Parent ,控件将重新缩放到目标显示。 为了防止这种情况, .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 ,因为它不包含任何常量

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM