NSIS中,我使用的是:在NSIS中,如何在使用nsDialogs :: Create 1018時設置對話框的大小?
...
nsDialogs::Create 1018
Pop $0
nsDialogs::Show
...
但該對話框的大小不適合我的需要。我如何爲這個對話框指定x和y的長度?
NSIS中,我使用的是:在NSIS中,如何在使用nsDialogs :: Create 1018時設置對話框的大小?
...
nsDialogs::Create 1018
Pop $0
nsDialogs::Show
...
但該對話框的大小不適合我的需要。我如何爲這個對話框指定x和y的長度?
如果要調整一切它可能是更好地使用資源黑客和ChangeUI
,但在運行時可以做到這一點:
!include nsDialogs.nsh
Function mypage
System::Call 'user32::SetWindowPos(i$hwndparent,i,i,i,i 640,i 480,i 0x16)' ; Resize outer dialog
nsDialogs::Create 1018
Pop $0
System::Call 'user32::MoveWindow(i$0,i0,i0,i 600,i 200,i0)' ; Resize inner (nsDialogs) page
${NSD_CreateLabel} 0 10u 100% 10u "Hello, welcome to nsDialogs!"
Pop $0
SetCtlColors $0 0xffffff 0xff2255
nsDialogs::Show
FunctionEnd
page custom mypage
我的對話是不是我把在所有控件身高不夠
我試過了你的兩個Windows API,當它們工作時,安裝的客戶區重疊並覆蓋了確定/取消按鈕。
我終於搞出了「使用資源黑客和ChangeUI」。這比我想象的要難得多。所以,這是一個更詳細的操作方法。我與nsDialogs NOT ModernUI深深紮根。所以這是nsDialog調整窗口大小的方法,這個窗口的創建方式與例子中一樣。 ModernUI覆蓋如上。
nsDialogs:創建1018
你有一個是代碼和預覽。請注意第一行代碼...
105 DIALOGEX 0, 0, 280, 162
在您的NSIS腳本中,您需要儘早添加對ChangeAll的調用。
ChangeUI all tall_UI.exe
Page custom nsDialogsPage
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
...
這爲我做。你會做一些試驗和錯誤,總是擊中commpile並保存在ResourceHacker中,然後重建你的NSI。您可能會注意到您的對話框比ResourceHacker中顯示的預覽更大或更小。這是因爲NSIS確實會根據字體大小,DPI ......等等來擴展對話框。嘗試並重試,直到看起來不錯。
你會注意到,nsDialogs:創建1018的號碼與資源黑客五號線:
CONTROL "", 1018, STATIC, SS_BLACKRECT | WS_CHILD | WS_GROUP, 7, 7, 266, 160
我做了1018資源得到這個演示在一起之後一些測試,定位和尺寸做有效果,但我不能告訴你爲什麼它不是黑色的。
我演示的完整代碼如下所示。
#Created with NSIS version 2.46 downloaded from SourceForge.net
#Based on "Adding Controls" section of user docs
# http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html#step-add
!include nsDialogs.nsh
Name "Launchpad"
OutFile "Master Installer.exe"
BrandingText " "
Caption "Launchpad"
RequestExecutionLevel admin
SetFont "Arial" 10
VIProductVersion "2.5.0.0"
Var Dialog
Var Button
ChangeUI all tall_UI.exe
Page custom nsDialogsPage
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
# It will create a new dialog in the page and return its HWND on the stack. The result must be popped from the stack to prevent stack corruption. If the result is error, the dialog couldn't be created.
${If} $Dialog == error
Abort
${EndIf}
# ${NSD_Create*} x y width height text
## Going to use $0 for y of each new control.
StrCpy $0 "29"
${NSD_CreateButton} 50% "$1u" 25% 12u "Product Manual"
Pop $Button
${NSD_OnClick} $Button Manual_Install_Clicked
IntOp $0 $0 + 18
IntOp $1 $0 - 2
${NSD_CreateButton} 50% "$1u" 25% 12u "Product 1 Installer"
Pop $Button
${NSD_OnClick} $Button Product1_Install_Clicked
IntOp $0 $0 + 18
IntOp $1 $0 - 2
${NSD_CreateButton} 50% "$1u" 25% 12u "Product 2 Installer"
Pop $Button
## ${NSD_OnClick} ...
IntOp $0 $0 + 18
IntOp $1 $0 - 2
${NSD_CreateButton} 50% "$1u" 25% 12u "Product 3 Installer"
Pop $Button
## ${NSD_OnClick} ...
IntOp $0 $0 + 18
IntOp $1 $0 - 2
${NSD_CreateButton} 50% "$1u" 25% 12u "Product 4 Installer"
Pop $Button
## ${NSD_OnClick} ...
IntOp $0 $0 + 18
IntOp $1 $0 - 2
${NSD_CreateButton} 50% "$1u" 25% 12u "Product 1 Installer"
Pop $Button
## ${NSD_OnClick} ...
IntOp $0 $0 + 18
IntOp $1 $0 - 2
${NSD_CreateButton} 50% "$1u" 25% 12u "Product 1 Installer"
Pop $Button
## ${NSD_OnClick} ...
IntOp $0 $0 + 18
IntOp $1 $0 - 2
nsDialogs::Show
FunctionEnd
Function ExecInstall
pop $0
ExecWait $0 $1
IfErrors 0 ExecDone
MessageBox MB_OK|MB_IconExclamation "$1 $0 not found"
ExecDone:
##Call Update_Install_Statuses
FunctionEnd
Function Manual_Install_Clicked
ExecShell "open" "$EXEDIR\Manual\Manual.PDF"
FunctionEnd
Function Product1_Install_Clicked
Exec "Explorer.exe $EXEDIR\Support Files"
FunctionEnd
Function Product2_Install_Clicked
Push "$EXEDIR\Product2 Folder\Product2 Installer.exe"
Call ExecInstall
FunctionEnd
Section
SectionEnd