Search code examples
user-interfaceinstallationsizensis

How do I center the UI and stretch the shape over the entire resolution? NSIS


I put the MUI_PAGE_COMPONENTS form. Next, for the installer, I set the resolution to 1280 by 720.

!define WIDTH 1280
!define HEIGHT 720

Function .onGUIInit
    GetDlgItem $0 $HWNDPARENT 1000 
    System::Call 'user32::MoveWindow(i $HWNDPARENT, i 0, i 0, i ${WIDTH}, i ${HEIGHT}, i 1)' MoveWindow(i $0, i 0, i 0, i ${WIDTH}, i ${HEIGHT}, i 1)' 
FunctionEnd

But all the UI elements are located in the upper-left corner. Is it possible to center and stretch the form (UI elements) to the entire size of the window? If not, how do I stretch the component box and description box?

screenshot

I searched , but I never found an easy solution. Is it really impossible to manipulate elements of ready-made forms?


Solution

  • The sane way to change the UI is to use Resource Hacker to modify one of the files in ...\NSIS\Contrib\UIs and apply it with !define MUI_UI myfile.exe.

    If you want to move things at run-time you can call MoveWindow or SetWindowPos (SetWindowPos allows you to move without resizing a control). If you do this, remember that some controls are in the inner dialog and some are not.