例子:全幅图片banner

优质
小牛编辑
126浏览
2023-12-01
引用脚本的内容:

Name "Test"
OutFile "Test.exe"
!include "MUI.nsh"
InstallDir $temp
Var pic_count   ;图片序号

!define MUI_UI "UI\modern.exe"  ;换一个修改过的UI
!define MUI_CUSTOMFUNCTION_GUIINIT GUIINIT

!insertmacro MUI_PAGE_WELCOME

;下面两行全部页面都要加。
!define MUI_PAGE_CUSTOMFUNCTION_PRE PRE     ;每页加载前都设置颜色
!define MUI_PAGE_CUSTOMFUNCTION_leave LEAVE ;每页加载后都隐藏上次的控件以刷新屏幕,否则新旧文字会混叠

!insertmacro MUI_PAGE_LICENSE "autoexec.bat"

!define MUI_PAGE_CUSTOMFUNCTION_PRE PRE
!define MUI_PAGE_CUSTOMFUNCTION_leave LEAVE
!insertmacro MUI_PAGE_DIRECTORY

!define MUI_PAGE_CUSTOMFUNCTION_PRE PRE
!define MUI_PAGE_CUSTOMFUNCTION_leave LEAVE
!insertmacro MUI_PAGE_DIRECTORY

!define MUI_PAGE_CUSTOMFUNCTION_PRE PRE
!define MUI_PAGE_CUSTOMFUNCTION_leave LEAVE
!insertmacro MUI_PAGE_DIRECTORY

!define MUI_PAGE_CUSTOMFUNCTION_PRE PRE
!define MUI_PAGE_CUSTOMFUNCTION_leave LEAVE
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "SimpChinese"

Section
SectionEnd


;—————以下代码插末尾—————

Function PRE
GetDlgItem $0 $HWNDPARENT 1037      ;第1行
SetCtlColors $0 0x0000ff transparent
ShowWindow $0 1
GetDlgItem $0 $HWNDPARENT 1038      ;第2行
SetCtlColors $0 0x0000ff  0x0080FF
ShowWindow $0 1
FunctionEnd

Function LEAVE       ;按下一步按钮时消隐标题字。图片号+1
GetDlgItem $0 $HWNDPARENT 1037
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 1038
ShowWindow $0 0
IntOp $pic_count $pic_count + 1
SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\$pic_count.bmp"

FunctionEnd

Function Back       ;按上一步按钮时消隐标题字。图片号-1,如果小于1的话不减了
GetDlgItem $0 $HWNDPARENT 1037
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 1038
ShowWindow $0 0
IntCmp $pic_count 1 +2 +2 +1
IntOp $pic_count $pic_count - 1
SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\$pic_count.bmp"
FunctionEnd

Function GUIINIT

GetFunctionAddress $R0 Back
ButtonEvent::AddEventHandler /NOUNLOAD 3 $R0


SetOutPath $PLUGINSDIR  ;释放图片
File "UI\*.bmp"

SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\1.bmp"   ;先出第一张图片

StrCpy $pic_count 1     ;图片序号1
FunctionEnd

另存附件