I'm using this solution:
Display image in top panel of Inno Setup wizard instead of page title and description
And I want set parameters like this:
WizardForm.WizardSmallBitmapImage.Visible := False;
WizardForm.PageDescriptionLabel.Color := clBlack;
WizardForm.PageNameLabel.Color := clBlack;
WizardForm.PageDescriptionLabel.Font.Color := clWhite;
WizardForm.PageNameLabel.Font.Color := clWhite;
but... i don't know how to make black backgrounds shorter under title and description. As you can see black strips going on to the face. It is possible at all?
I want something like this:
Already i have this:
To change labels width use theirs .Width property.
procedure InitializeWizard();
begin
{ ... }
WizardForm.PageDescriptionLabel.Width :=
WizardForm.PageDescriptionLabel.Width - ScaleX(120);
WizardForm.PageNameLabel.Width :=
WizardForm.PageNameLabel.Width - ScaleX(120);
end;
Or you can make the labels transparent:
Inno Setup - Transparency under text in page name and description labels
Related
I´m use this code: Long descriptions on Inno Setup components
I'm trying to change the color of the description of the ¨Additional Files¨ only. How to change the color only of this? (when i move the mouse over ¨additional components¨ or ¨componentes adicionales¨).
Try setting CompLabel.Font.Color:
if Index = 1 then
begin
CompLabel.Font.Color := clRed;
end
else
begin
CompLabel.Font.Color := clWindowText;
end;
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.
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.
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 Size 10
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.
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
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 like NORMALELEGANCE_INI or something including the word NORMAL.
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 to Center. If it isn't by default, change it to Center.
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.
[Code]
Type
TSize = Record
cx, cy: Integer;
end;
function GetTextExtentPoint32(hdc: THandle; s: string; c: Integer; var Size: TSize): Boolean;
external 'GetTextExtentPoint32W#Gdi32.dll stdcall';
function GetDC(hWnd: THandle): THandle;
external 'GetDC#User32.dll stdcall';
function SelectObject(hdc: THandle; hgdiobj: THandle): THandle;
external 'SelectObject#Gdi32.dll stdcall';
function AlignStringToCenter(S: String; const FontName: String; const MaxWidth, FontSize: Integer): String;
var
SWidth, SX, NSWidth: Integer;
SFont, SHandle: THandle;
StringModifier: TNewStaticText;
StringDimensions: TSize;
SHandleEx: TForm;
begin
if S = '' then
RaiseException('The specified Caption is an empty String')
else begin
Try
SHandleEx := TForm.Create(nil);
StringModifier := TNewStaticText.Create(SHandleEx);
StringModifier.Font.Name := FontName;
StringModifier.Font.Size := FontSize;
StringModifier.Parent := SHandleEx;
SX := 0;
StringModifier.Caption := S;
SHandle := GetDC(StringModifier.Handle);
SFont := SelectObject(SHandle, StringModifier.Font.Handle);
GetTextExtentPoint32(SHandle, StringModifier.Caption, Length(StringModifier.Caption), StringDimensions);
SelectObject(SHandle, SFont);
SWidth := StringDimensions.cx;
Repeat
Insert(' ', S, SX);
StringModifier.Caption := S;
Result := S;
SHandle := GetDC(StringModifier.Handle);
SFont := SelectObject(SHandle, StringModifier.Font.Handle);
GetTextExtentPoint32(SHandle, StringModifier.Caption, Length(StringModifier.Caption), StringDimensions);
SelectObject(SHandle, SFont);
NSWidth := StringDimensions.cx;
SX := SX + 1;
Until (NSWidth - SWidth) >= (MaxWidth - NSWidth);
Finally
StringModifier.Caption := '';
StringModifier.Free;
SHandleEx.Free;
SHandleEx.Close;
end;
end;
end;
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:
[Code]
Const
SM_CYSIZEFRAME = 33;
SM_CXSMICON = 49;
function GetSystemMetrics(nIndex : Integer): Integer;
external 'GetSystemMetrics#User32 stdcall';
procedure InitializeWizard;
begin
{ MaxWidth = WizardForm.Width - 2 * (WizardForm.FrameWidth + WizardForm.SmallIconWidth + WizardForm.CaptionLeft + WizardForm.CaptionRight) }
WizardForm.Caption := AlignStringToCenter(WizardForm.Caption, 'Segoe UI', WizardForm.Width - (2 * (GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CXSMICON) + 10 + 10)), 9);
end;
If you use a Visual Styles Skin:
[Code]
Const
SM_CYSIZEFRAME = 33;
SM_CXSMICON = 49;
function GetSystemMetrics(nIndex : Integer): Integer;
external 'GetSystemMetrics#User32 stdcall';
procedure InitializeWizard;
begin
{ MaxWidth = WizardForm.Width - 2 * (WizardForm.FrameWidth + WizardForm.SmallIconWidth + WizardForm.CaptionLeft + WizardForm.CaptionRight) }
WizardForm.Caption := AlignStringToCenter('Setup - {#MyAppName}', 'Window Title Font Name of your Visual Styles Skin', WizardForm.Width - (2 * (GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CXSMICON) + 10 + 10)), Window Title Font Size of your Visual Styles Skin);
end;
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 am trying to place a label on the wpPreparing page to indicate uninstallation of an existing version, prior to running the new installation. Here is my code:
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
UninstallingLabel: TNewStaticText;
intResultCode: Integer;
begin
with UninstallingLabel do
begin
Caption := 'Uninstalling existing version...';
Left := WizardForm.StatusLabel.Left;
Top := WizardForm.StatusLabel.Top;
Parent := wpPreparing.Surface;
end;
if strExistingInstallPath <> '' then
begin
Exec(GetUninstallString, '/verysilent /suppressmsgboxes', '', SW_HIDE,
ewWaitUntilTerminated, intResultCode);
end;
end;
The trouble is it does not seem to like Parent := wpPreparing.Surface and compiling fails with a
Semicolon (;) expected
error. This syntax works when adding a label to a custom created page. Why does this fail when trying to add it to wpPreparing?
The wpPreparing is not an object, it's just a numerical constant.
The WizardForm.PreparingPage holds a reference to the "Preparing to Install" page. Note that it is of type TNewNotebookPage already, not TWizardPage. So you use it directly as a parent.
Also note that the StatusLabel is on the "Installing" page. You probably want to relate your new label to the PreparingLabel instead.
And you have to create the UninstallingLabel.
UninstallingLabel := TNewStaticText.Create(WizardForm);
with UninstallingLabel do
begin
Caption := 'Uninstalling existing version...';
Left := WizardForm.PreparingLabel.Left;
Top := WizardForm.PreparingLabel.Top;
Parent := WizardForm.PreparingPage;
end;
Though do you really want to shadow the PreparingLabel (as you use its coordinates).
What about reusing it instead?
WizardForm.PreparingLabel.Caption := 'Uninstalling existing version...';
I've replayed your code. It works if you use just WizardForm as the parent. But it's in the top left corner of the form...
wpPreparing is the name of a constant that holds the ID of the correspnding page.
And you have to create an instance of UninstallingLabel
I'm trying to use this code How to make text Bold in TNewStaticText in inno setup to add it to this one:
procedure BackupCheckCreate();
begin
BackupCheck:=TCheckBox.Create(WizardForm);
with BackupCheck do
begin
Parent:=WizardForm.SelectDirPage;
SetBounds(ScaleX(WizardForm.DirEdit.Left), ScaleY(WizardForm.DirEdit.Top + 135), ScaleX(WizardForm.DirEdit.Width), ScaleY(15));
Caption := ExpandConstant('{cm:BackupCheck}');
Checked:=false;
end;
end;
so that it colours with red the Caption field, but no luck, any idea or suggestion?
Thanks so much in advanced.
Why my bitmap is not full screen size?
BitmapImage1 := TBitmapImage.Create(Page);
Its somehow made smaller by INNO ?
Tom, you must set the Parent,Align and Stretch properties to fill the background pf the custom page with your image.
try out this code
var
Page : TWizardPage;
BackgroundBitmapImage: TBitmapImage;
s: string;
begin
Page := CreateCustomPage(wpWelcome, 'Custom Page', 'Test');
ExtractTemporaryFile('background.bmp');
s:=ExpandConstant('{tmp}')+'\background.bmp';
BackgroundBitmapImage := TBitmapImage.Create(Page);
BackgroundBitmapImage.Bitmap.LoadFromFile(s);
BackgroundBitmapImage.Parent := Page.Surface;
BackgroundBitmapImage.Align:=alCLient;
BackgroundBitmapImage.Stretch:=True;
end;
is very nousy to do.
You must split your image in almost 3 piece
for WizardForm.MainPanel ( top strip of 60px)
for WizardForm.InnerPage (Center panel around Surface)
for mainPage.Surface (Inside inner Panel)
So is a big work of precise cutting....