Installation 如何为不同的NSIS安装程序设置不同的头位图';s页?

Installation 如何为不同的NSIS安装程序设置不同的头位图';s页?,installation,nsis,Installation,Nsis,如何为不同的页面设置不同的位图,例如,我想将一个位图设置为许可证页面的页眉,将另一个位图设置为目录页面的页眉?NSIS并不是专门为此设计的,但没有任何东西可以阻止您在pre和/或show回调函数中调整页面: !include MUI2.nsh !define MUI_HEADERIMAGE !insertmacro MUI_PAGE_WELCOME !define MUI_PAGE_CUSTOMFUNCTION_PRE resetimg !insertmacro MUI_PAGE_COMPO

如何为不同的页面设置不同的位图,例如,我想将一个位图设置为许可证页面的页眉,将另一个位图设置为目录页面的页眉?

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