User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

The PowerShell Studio v5.6.163 service release, included a splash screen snippet with a function that allows users to display a splash screen image. Now with the PowerShell Studio v5.6.164 service release, you can become a splash screen superstar with this form template:

Empty Form with Splash Screen

Empty Form with Splash Screen Template

 

The template comes with a preset splash screen image. As soon as you run the template, the preset splash screen will appear:

Loading Splash Screen

The Show-SplashScreen function is invoked in the form's Load event:

$formSplashScreen_Load = {
	<#
	Use the -PassTru parameter to update the splash screen text:
	.EXAMPLE
	$splashForm = Show-SplashScreen ... -PassThru
	#Update the splash screen text
	$splashForm.Text = 'Loading Modules...'
	#>
	
	$paramShowSplashScreen = @{
		Image = $pictureboxSplashScreenHidden.Image
		Title = 'Loading...'
		PassThru = $false
	}

	Show-SplashScreen @paramShowSplashScreen
	
	#TODO: Place initialization script here:
	
}

Place any initialization scripts after the line invoking the Show-SplashScreen function.

Note: The splash screen image is stored within a hidden PictureBox control, which allows you to distribute the script without having an external dependency.

What if I have an existing form?

We included a control set so you can add a splash screen to your existing forms.

Form – Splash Screen

Form Splash Screen control set

Like the form template, the control set comes with the preset splash screen image contained within a hidden PictureBox control. When you add the control set, PowerShell Studio will prompt about replacing the form's Load event:

Replace Event

It is recommended to use the Append option if you are using an existing Load event, although you are encouraged to move any initialization scripts into the new formSplashScreen_Load event script block.

Using a Custom Image

If you wish to use a custom image, you can replace the image in the hidden PictureBox via the designer:

Set Image in Designer

1. Select the hidden PictureBox (name: pictureboxSplashScreenHidden).

2. Use the Image property of the PictureBox to select your own custom splash screen image.

You're a Superstar!

Armed with this form template and control set, you are now a splash screen superstar! Please let us know what you think about the splash screen templates.

Related Articles

For more details on the PictureBox control, refer to the Spotlight on the PictureBox article.

The Holy Splash Screens Batman! article covers the Show-SplashScreen function and how to use an image on disk.

If you have questions about our products, please post in our support forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.
Copyright © 2024 SAPIEN Technologies, Inc.