How to change line spacing of the label text in NSIS? - nsis

In every page, the text's line-spacing is too small, how to make it bigger?
you see
I found that if I increase the font size, the line-spacing can be larger, but at the same time, the window size increases too.

That text is displayed by the Windows Static control. I don't see anything in the documented styles that would change the line spacing. There is SS_EDITCONTROL but it does not seem to have any effect on the line spacing:
!include nsDialogs.nsh
!undef __NSD_Label_STYLE
!define __NSD_Label_STYLE ${DEFAULT_STYLES}|${SS_NOTIFY}|${SS_EDITCONTROL}
!undef NSD_CreateLabel
!insertmacro __NSD_DefineControl Label
!include "MUI2.nsh"
...
I believe the Static control uses DrawText to draw the text and it has a DT_EXTERNALLEADING flag that might change the line height but I don't think there is a way to enable the flag.
Without any further information to go on I have to assume that the Static control is the best way to display this kind of text and that Windows is displaying the text correctly.
If you are not running a Chinese version of Windows then you should make sure that you have the appropriate language pack and fonts installed so Windows can use the best available font (Chinese (Simplified) supplemental fonts
& Chinese (Traditional) supplemental fonts). This is especially important on Windows 10 because it removed some of the far east fonts by default.

Related

NSIS - How can I replace the various bitmaps in the NSIS ultra-modern user interface with my own?

Good Morning,
I have a problem with the naming of the individual bitmaps. What are their names?
The bitmap or icon on the title bar of the windows?
Can I place a Bitmap in the area below the title bar too?
The large bitmap on the left of each page?
How can I replace the NSIS bitmaps with my own in my script?
The same goes for the Uninstall pages, and how do I show Uninstall in the start menu together with Install including the icons?
The installation and uninstallation of my Application run flawlessly, only the damned bitmaps do not work. Can someone help me?
All the defines are listed in the UMUI documentation.
!define UMUI_HEADERBGIMAGE_BMP c:\foo.bmp
!define UMUI_LEFTIMAGE_BMP c:\bar.bmp
# UMUI_UNHEADERBGIMAGE_BMP...
!include "UMUI.nsh"

Scale radio button list with font size in Inno Setup

When trying to apply a custom installation mask with radio buttons (I used code provided in Replace installation types dropdown list by radio buttons) I see I am unable to use higher fonts as a little spacing should be needed between one radio button field and another one. To give you a visual example:
As default font size are not so easy to be read I wonder if there is a way of adding extra spacing between one radio button field and the next one.
Checkboxes and Radio buttons created on runtime in Inno Setup do not scale their height automatically with a DPI/font size.
So you have to scale them programmatically.
...
RadioButton.Left := WizardForm.TypesCombo.Left;
RadioButton.Height := ScaleY(RadioButton.Height);
RadioButton.Top := WizardForm.TypesCombo.Top + I * RadioButton.Height;
...
The ScaleY(RadioButton.Height) takes the default combobox/radiobutton height, which is designed for the default font and no display scaling (100%) and scales that to the custom font and actual display scaling.
Though note that using a non-default font-size for your application/setup is not a good idea. The user should choose a font size he/she is comfortable with in Windows preferences. You should not override his/her choice.
When changing the font size, do not modify the shared default.isl, use the [LangOptions] section of your project file instead:
[LangOptions]
DialogFontSize=20

NSIS - How display a static sidebar image by extending the dialog

I hope someone out there can help me with my little problem. Currently, i work on a installer based on NSIS. I know, there is a sidebar image that i can set for welcome and finish page, but i want a sidebar image which is shown the whole time during i switch the pages. The size of the pages shouldnt change, but the dialog must be, for example 92px, bigger in the width to display the image.
My question is, how can i achieve this? By custom pages? A little example would be very nice!
Thanks a lot.
The sidebar on the welcome and finish pages come from the Modern UI scripts that are part of the NSIS install but it only supports a small header image for the other pages. If you want the sidebar on all pages you have to use something other than the MUI.
Creating your own version is not that hard:
InstallDir "$Temp\Example"
AddBrandingImage left 150 2 ; Reserve some space in the UI
LicenseData "${__FILE__}"
Page License
Page Components
Page Directory
Page InstFiles
Function .onGuiInit
InitPluginsDir
File "/oname=$PluginsDir\Wizard.bmp" "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp"
SetBrandingImage /resizetofit "$PluginsDir\Wizard.bmp"
FunctionEnd
Section Hello
SectionEnd
Section World
SectionEnd
Depending on the size of your image, this might be all you need, if not then you would have to use Resource Hacker on one of the files in %NSIS%\Contrib\UIs and then use ChangeUI in your script.
Have you taken a look at some of the 3rd-party NSIS UIs that have been created? InstallSpiderUI perhaps?

How to put background on the top for internal pages of installer

How can I put the background image to the top of internal installer page, so it takes all header area.
In solution below background takes only left side of the header
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "top.bmp"
!include "MUI2.nsh"
You can't do this without modifying a UI executable. See the MUI 2 docs, specifically the MUI_UI definition. You'd need to take the default executable and with a resource hacker change the size of that header image.
You may also be able to swing this with resource hacking and the value of MUI_UI_HEADERIMAGE (see those docs). I'm not sure, though, as I've never tried it.
I have found the answer
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH

Help with application icons

I'm building a program in C++ (target is windows XP) using Visual Studio 2008 and I'm trying to add application icons, the ones that show up in the taskbar, explorer, desktop, etc. My .ico file has the sizes 48x48, 32x32, 24x24, and 16x16 pix in color depths 32-bit, 24-bit, 256 colors, and 16 colors. For what it's worth, I'm adding the .ico file to the binary in IcoFX.
I can get all the icons to show up like they should except for the one in the upper left corner of the program itself--the one that you can click on to bring up a menu with window size options--it still shows the default icon.
To get this little icon to change do I need a different image size or is there a completely different way of managing this one icon? Does that icon even have a specific name?
Thanks for your help.
Duplicated: How do I set the icon for my application in visual studio 2008?
According to one answer on that thread, you need to make sure that your icon is the first icon in the resources file.
Ok, I've figured it out:
I'm using wxWidgets as my GUI toolkit, so this is the only satisfactory answer I can give. wxWidgets has classes to set the main frame icons, those classes include wxIcon and wxIconBundle. Then wxTopLevelWindow::SetIcons can be used to set the application's icons. This sets ALL the icons (taskbar, main frame, alt-tab chooser, etc), no need to mess with a resource file in Visual Studio.

Resources