Be a splash screen superstar with this template!
- Details
- Written by David Corrales
- Last Updated: 09 October 2019
- Created: 11 June 2019
- Hits: 9151
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
The template comes with a preset splash screen image. As soon as you run the template, the preset splash screen will appear:
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
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:
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:
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.
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.