문제 설명
TBitmapImage는 Inno Setup 6에서 크기 조정된 디스플레이의 크기보다 크게 렌더링됩니다. (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;
참조 솔루션
방법 1:
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.
(by Maverick、Martin Prikryl)