windows - 如何为自定义 nsis 安装程序添加边框
问题描述
我正在 NSIS/MUI2.nsh 的帮助下开发自定义安装程序。我正在努力为安装程序添加边框。
当我处理欢迎页面和完成页面时,我只需向位图添加边框(只需绘制它)并将其设置为相应地控制 id 1044。如何将边框添加到许可证、组件或目录页面?
解决方案
您可以通过创建额外的窗口来添加额外的边框:
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
内部对话框中的窗口仅在该页面上可见,其他窗口在所有页面上可见。
推荐阅读
- php - 如何在 PHP 中构建具有多个参数的 WHERE 子句
- java - java: SQL_Exception 处理
- python - networkx 力有向图
- css -
标签应根据文本动态增加大小 - reactjs - react-redux 中的打字稿错误:“在构造函数之外或在构造函数内的嵌套函数中不允许超级调用”
- android - 如何在 webview 中聚焦文本字段时隐藏 Android 软键盘?
- angular - 从 2019-08-08T20:41:00-1000 转换为 2019 年 8 月 8 日 08:41 PM HST
- azure-logic-apps - 当结果集在逻辑应用中有一条记录时,Foreach 不支持
- wget - 领事服务给了我一个 403 禁止
- python - 将模型参数的平方和添加到损失函数