如何为不同的页面设置不同的位图,比方说,我想将位图设置为许可页面的标题,将另一个位图设置为目录页面的标题?
答案 0 :(得分:1)
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