NSIS改变界面字体大小
侧边栏壁纸
  • 累计撰写 29 篇文章
  • 累计收到 129 条评论

NSIS改变界面字体大小

nsisfans
2022-01-29 / 0 评论 / 107 阅读 / 正在检测是否收录...

NSIS改变字体大小.jpg

;NSIS Modern User Interface
;Multilingual Example Script
;Written by Joost Verburg

;--------------------------------
;Include Modern UI

!include "MUI.nsh"

;--------------------------------
;General

;Name and file
Name "Modern UI Test"
OutFile "MultiLanguage.exe"

;Default installation folder
InstallDir "$PROGRAMFILES\Modern UI Test"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Modern UI Test" ""

;--------------------------------
;Interface Settings

!define MUI_ABORTWARNING

;--------------------------------
;Language Selection Dialog Settings

;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI Test"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"

;--------------------------------
;Pages

!define MUI_PAGE_CUSTOMFUNCTION_SHOW ChangeMainFont
!insertmacro MUI_PAGE_LICENSE $(MUILicense)
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ChangeFont2
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ChangeFont
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English" # first language is the default language
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"

;--------------------------------
;License Language String

LicenseLangString MUILicense ${LANG_ENGLISH} "${NSISDIR}\Docs\Modern UI\License.txt"
LicenseLangString MUILicense ${LANG_SIMPCHINESE} "${NSISDIR}\Docs\Modern UI\License.txt"
LicenseLangString MUILicense ${LANG_TRADCHINESE} "${NSISDIR}\Docs\Modern UI\License.txt"

;--------------------------------
;Reserve Files

;These files should be inserted before other files in the data block
;Keep these lines before any File command
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)

!insertmacro MUI_RESERVEFILE_LANGDLL

;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...

;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

;--------------------------------
;Installer Functions

Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY

FunctionEnd

;--------------------------------
;Descriptions

;USE A LANGUAGE STRING IF YOU WANT YOUR DESCRIPTIONS TO BE LANGAUGE SPECIFIC

;Assign descriptions to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
   !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} "A test section."
!insertmacro MUI_FUNCTION_DESCRIPTION_END


;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\Modern UI Test"

SectionEnd

;--------------------------------
;Uninstaller Functions

Function un.onInit

!insertmacro MUI_UNGETLANGUAGE

FunctionEnd

Function ChangeFont
FindWindow $0 "#32770" "" $HWNDPARENT ;$0 保存主窗口句柄
GetDlgItem $R0 $0 1001
CreateFont $R1 "宋体" 9 0  ;浏览按钮字体
SendMessage $R0 ${WM_SETFONT} $R1 0
GetDlgItem $R0 $0 1006
CreateFont $R1 "宋体" 15 0  ;安装目录选择页面 字体
SendMessage $R0 ${WM_SETFONT} $R1 0
FunctionEnd

Function ChangeFont2
FindWindow $5 "#32770" "" $HWNDPARENT
GetDlgItem $R5 $5 1032
CreateFont $R2 "宋体" 11 0   ;组件选择名称字体
SendMessage $R5 ${WM_SETFONT} $R2 0
GetDlgItem $R5 $5 1042
SendMessage $R5 ${WM_SETFONT} $R2 0
FunctionEnd

Function ChangeMainFont
FindWindow $2 "#32770" "" $HWNDPARENT
CreateFont $R2 "宋体" 104 0
GetDlgItem $R5 $2 1
SendMessage $R5 ${WM_SETFONT} $R2 0
GetDlgItem $R6 $2 2
SendMessage $R6 ${WM_SETFONT} $R2 0
GetDlgItem $R6 $2 3
SendMessage $R6 ${WM_SETFONT} $R2 0
FunctionEnd
0

评论 (0)

取消