Customize Font Size for WelcomePrompt

Hi there,

Is there any way I can increase the text size of WelcomePrompt? It´s kinda small…
I already found out, how to increase the Timer Size.

psappdeploy

Thanks,
Robert

In the “AppDeployToolkitMain.ps1” file, search for ‘## Form Welcome’. Add the following row to the form controls. Obviously you can choose your own font and size my sample:
$formWelcome.Font = New-Object System.Drawing.Font(“Segoe UI”,12.5,[System.Drawing.FontStyle]::Regular)

This is what mine looks like with changing the background color and font color:
## Form Welcome
$System_Drawing_Size = New-Object -TypeName ‘System.Drawing.Size’
$System_Drawing_Size.Height = 0
$System_Drawing_Size.Width = 0
$formWelcome.Size = $System_Drawing_Size
$formWelcome.Padding = $paddingNone
$formWelcome.Margin = $paddingNone
$formWelcome.DataBindings.DefaultDataSourceUpdateMode = 0
$formWelcome.Font = New-Object System.Drawing.Font(“Segoe UI”,12.5,[System.Drawing.FontStyle]::Regular)
$formWelcome.BackColor = “#4e4e4e
$formWelcome.ForeColor = “WhiteSmoke”
$formWelcome.Name = ‘WelcomeForm’
$formWelcome.Text = $installTitle
$formWelcome.StartPosition = ‘CenterScreen’
$formWelcome.FormBorderStyle = ‘FixedDialog’
$formWelcome.MaximizeBox = $false
$formWelcome.MinimizeBox = $false
$formWelcome.TopMost = $TopMost
$formWelcome.TopLevel = $true
$formWelcome.Icon = New-Object -TypeName ‘System.Drawing.Icon’ -ArgumentList $AppDeployLogoIcon
$formWelcome.AutoSize = $true
$formWelcome.Controls.Add($pictureBanner)
$formWelcome.Controls.Add($flowLayoutPanel)

2 Likes

Ah, thank you very much!

Hey, I too want to do the same, but I do not see that section you mentioned on my AppDeployToolkitMain.ps1. Maybe it changed since then. Thanks

Is there a way to modify specific line of text in the Welcome section and make it bold? I’m referring specifically to this line in the AppDeployToolkitConfig.xml:
<WelcomePrompt_CustomMessage> </WelcomePrompt_CustomMessage>
What section would I have to update in AppDeployToolkitMain.ps1?
I already have this in place but it updates the entire welcome section text:
$labelAppName.Text = $labelAppNameText
$labelAppName.TextAlign = ‘TopCenter’
$labelAppName.Anchor = ‘Top’
$labelAppName.AutoSize = $true
$labelAppName.add_Click($handler_labelAppName_Click)
$labelAppName.Font = ‘Microsoft Sans Serif, 9pt, style=Bold’

Thanks!

1 Like

Did you ever find a solution for this? Its exactly what I’m trying to do now.

Ok, I’ll give it a try.

In AppDeployToolkitMain.ps1 I look for WelcomePrompt_CustomMessage and I found where it reads the XML:

	[string]$configWelcomePromptCustomMessage = $xmlUIMessages.WelcomePrompt_CustomMessage

Now I look for $configWelcomePromptCustomMessage in the AppDeployToolkitMain.ps1
I find it in Function Show-WelcomePrompt

		If ($CustomText -and $configWelcomePromptCustomMessage) {
			$labelCustomMessage.Text = $configWelcomePromptCustomMessage
			$flowLayoutPanel.Controls.Add($labelCustomMessage)
		}

Now I look for $labelCustomMessage and I find this:

		## Label CustomMessage
		$labelCustomMessage.DataBindings.DefaultDataSourceUpdateMode = 0
		$labelCustomMessage.Name = 'labelCustomMessage'
		$labelCustomMessage.Size = $defaultControlSize
		$labelCustomMessage.MinimumSize = $defaultControlSize
		$labelCustomMessage.MaximumSize = $defaultControlSize
		$labelCustomMessage.Margin = New-Object -TypeName 'System.Windows.Forms.Padding' -ArgumentList 0,0,0,5
		$labelCustomMessage.Padding = New-Object -TypeName 'System.Windows.Forms.Padding' -ArgumentList 10,0,10,0
		$labelCustomMessage.TabStop = $false
		$labelCustomMessage.Text = $configClosePromptMessage
		$labelCustomMessage.TextAlign = 'MiddleCenter'
		$labelCustomMessage.Anchor = 'Top'
		$labelCustomMessage.AutoSize = $true
		$labelCustomMessage.add_Click($handler_labelCustomMessage_Click)

Now you’d think the .Size , .MinimumSize or .MaximumSize properties would be the key. Alas no. The $defaultControlSize thing is for the Label box size, not the font size.

I found this line that defines this object as a Label in Windows.Forms lingo (XAML is the way to go today, BTW)
$labelCustomMessage = New-Object -TypeName 'System.Windows.Forms.Label'

I go in the internet to see what are the properties of label object in Windows.Forms
I find (c# - Easiest way to change font and font size - Stack Overflow]

YourLabel.Font = new Font("Arial", 24,FontStyle.Bold)

So our solution is something like:

$labelCustomMessage.Font = New-Object System.Drawing.Font(“Segoe UI”,12.5,[System.Drawing.FontStyle]::Regular)

Gee that looks familiar. :astonished:

1 Like

This is pretty much what I said years ago… :slight_smile:

Hi All,

I have a requirement that is somewhat similar to this. But what I only wanted to modify is just the Deadline date to color red so it is easily recognizable to my users.

any ideas how to do this?

I wanted to change the highlighted item below to color red and its font size or make it bold. Even better the whole Deadline and the date and time.

I tried to follow your script above and work my way around and see if I can change the font color but I’m struggling to find the answer.

image

regards,
A

In AppDeployToolkitMain.ps1, you’ll have to edit this section of the Show-WelcomePrompt Function:

## Label Defer
$labelDefer.DataBindings.DefaultDataSourceUpdateMode = 0
$labelDefer.Name = 'labelDefer'
$labelDefer.Size = $defaultControlSize
$labelDefer.MinimumSize = $defaultControlSize
$labelDefer.MaximumSize = $defaultControlSize
$labelDefer.Margin = New-Object -TypeName 'System.Windows.Forms.Padding' -ArgumentList 0,0,0,5
$labelDefer.Padding = New-Object -TypeName 'System.Windows.Forms.Padding' -ArgumentList 10,0,10,0
$labelDefer.TabStop = $false
$deferralText = "$configDeferPromptExpiryMessage`r`n"

If ($deferTimes -ge 0) {
	$deferralText = "$deferralText `r`n$configDeferPromptRemainingDeferrals $([int32]$deferTimes + 1)"
}
If ($deferDeadline) {
	$deferralText = "$deferralText `r`n$configDeferPromptDeadline $deferDeadline"
}
If (($deferTimes -lt 0) -and (-not $DeferDeadline)) {
	$deferralText = "$deferralText `r`n$configDeferPromptNoDeadline"
}
$deferralText = "$deferralText `r`n`r`n$configDeferPromptWarningMessage"
$labelDefer.Text = $deferralText
$labelDefer.TextAlign = 'MiddleCenter'
$labelDefer.AutoSize = $true
$labelDefer.add_Click($handler_labelDefer_Click)

But what data type is $labelDefer variable?
The $labelDefer is declared near the top of the Show-WelcomePrompt function like this:
$labelDefer = New-Object -TypeName 'System.Windows.Forms.Label'

According to MS, a system.windows.forms.label object has BackColor and ForeColor properties. so you can try:
$labelDefer.ForeColor = Color.FromName("Red")

You might, however, not like the results because almost the entire message will change color.

1 Like

thanks will give this a go and keep you updated.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.