繁体   English   中英

如何为不同的 NSIS 安装程序页面设置不同的 header 位图?

[英]How to set different header bitmaps for different NSIS installer's pages?

How can i set different bitmaps for different pages, say, i want to set a bitmap to be header of license page and another bitmap to be header of directory page?

NSIS 的设计初衷并非如此,但没有什么能阻止您在 pre 和/或 show 回调函数中调整页面:

!include MUI2.nsh
!define MUI_HEADERIMAGE

!insertmacro MUI_PAGE_WELCOME

!define MUI_PAGE_CUSTOMFUNCTION_PRE resetimg
!insertmacro MUI_PAGE_COMPONENTS

!define MUI_PAGE_CUSTOMFUNCTION_PRE setdirimg
!insertmacro MUI_PAGE_DIRECTORY

!define MUI_PAGE_CUSTOMFUNCTION_PRE resetimg
!insertmacro MUI_PAGE_COMPONENTS

!insertmacro MUI_LANGUAGE "English"

!macro fixheaderimgafterupdate
;Ugly way to trigger a repaint
GetDlgItem $0 $hwndparent 1046
ShowWindow $0 0
ShowWindow $0 1
!macroend

Function setdirimg
File "/oname=$PLUGINSDIR\hdrdir.bmp" "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
SetBrandingImage /IMGID=1046 "$PLUGINSDIR\hdrdir.bmp"
!insertmacro fixheaderimgafterupdate
FunctionEnd

Function resetimg
#SetBrandingImage /IMGID=1046 "$PLUGINSDIR\modern-header.bmp" ;This also works, but does not deal with stretching etc
!insertmacro MUI_HEADERIMAGE_INIT ""
!insertmacro fixheaderimgafterupdate
FunctionEnd

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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