Modifying Botton Layout + Size

Hey everyone, got another basic question.

All I want to do is two things with my “ClosePrompt_ButtonClose” button:

  • Move it to the middle
  • Make it bigger so it can fit more text

Example

Any idea how to do this? I am looking at the “Show-WelcomePrompt” function in the AppyDeployToolkitMain.ps1 but I am not sure what needs to be modified.

I found this thread researching the topic but I still need a hand:

Thanks again for all the help everyone.

I’m guessing your code is something like this:
Show-InstallationWelcome -CloseApps 'outlook'

As for modifying the GUI, Show-InstallationWelcome uses the Show-WelcomePrompt function to actually display the GUI.

The text for the [Close Apps] Button is contained inside $configClosePromptButtonClose as per line:
$buttonCloseApps.Text = $configClosePromptButtonClose

The contents (aka text) of $configClosePromptButtonClose is set via the XML file using this code near the beginning of AppDeployToolkitMain.ps1:

[string]$configClosePromptButtonClose = $xmlUIMessages.ClosePrompt_ButtonClose

As for the size and location of the button, the following is a modified block of code:

		## Button Close For Me
		$buttonCloseApps.DataBindings.DefaultDataSourceUpdateMode = 0
		$buttonCloseApps.Location = New-Object -TypeName 'System.Drawing.Point' -ArgumentList 14,4
		$buttonCloseApps.Name = 'buttonCloseApps'
	#	$buttonCloseApps.Size = $buttonSize
		$buttonCloseApps.Size = 160,24	# x,y
		$buttonCloseApps.MinimumSize = $buttonSize
	#	$buttonCloseApps.MaximumSize = $buttonSize #must not use of else size is locked to $buttonSize
		$buttonCloseApps.TabIndex = 1
		$buttonCloseApps.Text = $configClosePromptButtonClose
		$buttonCloseApps.DialogResult = 'Yes'
		$buttonCloseApps.AutoSize = $true
		$buttonCloseApps.Margin = $paddingNone
		$buttonCloseApps.Padding = $paddingNone
		$buttonCloseApps.UseVisualStyleBackColor = $true
		$buttonCloseApps.add_Click($buttonCloseApps_OnClick)

Modify the lines with $buttonCloseApps.Location and $buttonCloseApps.Size as you see fit.

1 Like

@That-Annoying-Guy thanks again for all the help.

What I did to move my button lay out was modify

$buttonCloseApps.Location = New-Object -TypeName 'System.Drawing.Point' -ArgumentList 160,4 #these values modify the x,y axis so I changed them from 14,4

Then, in order to make my button bigger what I did was modify the “$buttonSize” variable (because the $buttonCloseApps.MinimumSize receives it’s value from it) to the following:

$buttonSize = New-Object -TypeName 'System.Drawing.Size' -ArgumentList 160,24 #modifying these two values changes the height and width with the default being 130,24

This worked perfectly because I am only using one button anyway:
Perfect

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