I need to find what is the Font.Color
, Font.Size
and Font.Name
of Inno Setup WizardForm.Caption
to get its (It is a String) Extent Point using GetTextExtentPoint32
.
Please let me know how can I find the above properties of WizardForm. (Not the System Font Properties). I want to get current Font Information of WizardForm according to the .cjstyles Skin I am using.
And I also like to know how to center Wizard Window Title using Pascal Script after knowing those font information.
Thanks in Advance.
The Window Title Properties of WizardForm is internally loaded by the ISSkin.DLL according to your Visual Styles Skin. So, if there were any System Metrics for Window Titles user configured in Advanced Appearance Settings in Control Panel like:
Window Title - Font Name
Segoe UI
and Font Size10
all those will be overridden by the ISSKin.DLL when loading the specified Visual Style because it has different fonts and font size configurations in their .INI Files whose loaded by the function
LoadSkin
like shown below.The .INI file you're providing here has almost all information on how Skin is to loaded from the resources like Bitmpas stored in Skin File.
However you can center WizardForm Caption using two different options.
Using Resource Hacker:
Using Resource Hacker, it is possible to set the Skin's Window Title (Caption) Alignment to Center very easily.
1.Open your Visual Styles Skin (.cjstyles or .msstyles) File using Resource Hacker and look for a Resource group named
TEXTFILE
.2.Expand it and find the .INI File according to what color scheme is loaded default by ISSkin.dll. In most situations and if your system font size is 100% (default), it should be the Normal Color scheme. So click on the .INI File which has the word NORMAL in its name like shown below:
For example, if your Skin File name is
Elegance.cjstyles
, the .INI File with Normal color scheme should be likeNORMALELEGANCE_INI
or something including the wordNORMAL
.3.Open this .INI File in internal text editor comes with Resource Hacker and find the line
Window.Caption
like shown below:4.And make sure its
ContentAlignment
is set toCenter
. If it isn't by default, change it toCenter
.Now, the Window Title of the Wizard should be centered after the Skin is loaded by ISSkin.DLL.
NOTE: This centering is not accurate because the centering is done between caption left and minimize button, so caption may still near to left side even after Centering it this way.
Using Pascal Script [Code] Section:
You can center WizardForm Caption by adding white spaces into its front.(but not recommended.)
A Code like this will do what you need.
Above Code keeps adding spaces in front to the String you want to be centered until it is properly centered in the Max String Width you given, and outputs the modified string with added spaces.
NOTE: The
MaxWidth
Parameter here should be the Width you want to center the String. A string which has a higher width than you specify here can not be centered correctly. And a Visual Styles Skin is not necessary to center Wizard Window Title using above function.Usage:
If you want to use this function to center Wizard Window Title, use it like:
If you don't use a Visual Styles Skin:
If you use a Visual Styles Skin:
Centered Wizard Window Title:
However, centering Wizard Window Title using above function (Hacking it by adding spaces) causes the following bad effect in Windows Taskbar Tooltips:
NOTE: WizardForm.CaptionLeft and CaptionRight should vary with the Size of your Visual Styles Skin's Left Caption Margin if you use a Visual Styles Skin.
I do not think this is possible.
The window title is custom-drawn by the ISSkin DLL. So Windows does not know the font size, hence you cannot use Windows API.
And ISSkin does not export any function to retrieve this information.