简体   繁体   中英

How to add a border to customized nsis installer

I am working on customized installer with the help of NSIS/MUI2.nsh. I am struggling with adding a border to the installer.

When I work on the welcome and finish pages I just add border to the bitmap(simply draw it) and set it to control id 1044 accordingly. How can I add the border to the license, components or directory pages?

You can add extra borders by creating extra windows:

OutFile Test.exe
RequestExecutionLevel user

Page License "" onLicShow
Page InstFiles

!include nsDialogs.nsh ; WS_*
Function onLicShow
GetDlgItem $5 $hWndParent 0xFFFFFFFF
ShowWindow $5 0 ; Hide the original line
System::Call 'USER32::GetWindowRect(pr5,@r0)' ; NSIS v3+
System::Call 'USER32::MapWindowPoints(p0, p$hWndParent, pr0, i1)'
System::Call '*$0(i.r1,i.r2,i.r3,i.r4)'
IntOp $2 $2 - 2 ; Adjust a little up
System::Call 'USER32::CreateWindowEx(i0, t"STATIC", p0, i ${WS_VISIBLE}|${WS_CHILD}, i 0, i r2, i 9999, i 4, p$hWndParent, p0, p0, p0)p.r0'
SetCtlColors $0 "" 0xff0000 ; Red

System::Call 'USER32::CreateWindowEx(i0, t"STATIC", p0, i ${WS_VISIBLE}|${WS_CHILD}, i 0, i 0, i 4, i 9999, p$hWndParent, p0, p0, p0)p.r0'
SetCtlColors $0 "" 0x00ff00 ; Green

System::Call 'USER32::GetClientRect(p$hWndParent,@r0)' ; NSIS v3+
System::Call '*$0(i,i,i.r3,i)'
IntOp $3 $3 - 4 ; X = Window width - border width
System::Call 'USER32::CreateWindowEx(i0, t"STATIC", p0, i ${WS_VISIBLE}|${WS_CHILD}, i $3, i 0, i 4, i 9999, p$hWndParent, p0, p0, p0)p.r0'
SetCtlColors $0 "" 0xffff00 ; Yellow

System::Call 'USER32::CreateWindowEx(i0, t"STATIC", p0, i ${WS_VISIBLE}|${WS_CHILD}, i 0, i 0, i 9999, i 4, p$hWndParent, p0, p0, p0)p.r0'
SetCtlColors $0 "" 0xffffff ; White

FindWindow $1 "#32770" "" $hWndParent ; Find the inner dialog
System::Call 'USER32::CreateWindowEx(i0, t"STATIC", p0, i ${WS_VISIBLE}|${WS_CHILD}, i 0, i 0, i 9999, i 7, p$1, p0, p0, p0)p.r0'
SetCtlColors $0 "" 0x0000ff ; Blue
FunctionEnd

Windows in the inner dialog are only visible on that page, other windows are visible on all pages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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