Inno Installation Installing image / control on user page

I am trying to create an image on a special page that I can get to display a user page or an image on a predefined page, but not on a user page.

The problem, I think, with Parent := CustomPage.ID; .

Parent := WizardForm.SelectTasksPage; works.

How to do it right?

 procedure ImageOnClick(Sender: TObject); var ErrorCode: Integer; begin ShellExec('', 'http://test.com', '', '', SW_SHOW, ewNoWait, ErrorCode); end; var CustomPage: TWizardPage; BtnImage: TBitmapImage; procedure InitializeWizard; begin CustomPage := CreateCustomPage(wpLicense, 'Heading', 'Sub heading.'); ExtractTemporaryFile('image.bmp'); BtnImage := TBitmapImage.Create(WizardForm); with BtnImage do begin Parent := CustomPage.ID; Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\image.bmp'); AutoSize := True; Left := 90; Top := WizardForm.SelectTasksPage.Top + WizardForm.SelectTasksPage.Height - Height - 8; Cursor := crHand; OnClick := @ImageOnClick; end; end; 
+2
inno-setup
Apr 29 '17 at 14:00
source share
2 answers

That TWizardPage.Surface for type TNewNotebookPage for.

Also, never use absolute coordinates and dimensions. Your layout will break when the wizard displays on a high DPI / scaled display, which is now quite common with retina displays. Use ScaleX and ScaleY . For the same reason, you must have images with different resolutions (see Inno Setup WizardImageFile looks bad with font scaling in Windows 7 ). Or at least scale / stretch the bitmap.

 CustomPage := CreateCustomPage(wpLicense, 'Heading', 'Sub heading.'); ExtractTemporaryFile('image.bmp'); BtnImage := TBitmapImage.Create(WizardForm); with BtnImage do begin Parent := CustomPage.Surface; Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\image.bmp'); AutoSize := True; AutoSize := False; Height := ScaleX(Height); Width := ScaleY(Width); Stretch := True; Left := ScaleX(90); Top := WizardForm.SelectTasksPage.Top + WizardForm.SelectTasksPage.Height - Height - ScaleY(8); Cursor := crHand; OnClick := @ImageOnClick; end; 

Layout 100% scaling (96 DPI):

Layout 100% scaling (96 DPI)

Layout 150% scaling (144 DPI):

150% scale layout (144 DPI)

150% scale layout (144 DPI) with image scaling and scaling:

150% scale layout (144 DPI) with offset / size scaling and image stretching

+1
Apr 29 '17 at 17:02 on
source share
— -

you can use the Botva2 library http://krinkels.org/threads/botva2.1931/ use google translate if you can not understand rusian u can create some amazing installer using this image fe Example Botva2

 [code] #include "botva2.iss" var SomeImage : Longint; procedure InitializeWizard(); begin {Your Custom page Code Goes Here} SomeImage := ImgLoad(WizardForm.Handle,'Image.bmp',0,0,854,480,true,true)‌​; end; procedure CurPageChanged(CurPageID: Integer); begin ImgSetVisibility(SomeImage,false); if (CurPageID = CustomPage.ID) ImgSetVisibility(SomeImage,true); end; 
0
Apr 29 '17 at 18:36
source share



All Articles