User Rating: 3 / 5

Star ActiveStar ActiveStar ActiveStar InactiveStar Inactive
 

PowerShell Studio has a custom control called ProgressBarOverlay. This progress control functions exactly like the typical progress bar, with the added ability of displaying a text percentage over the progress bar.

Adding a ProgressBarOverlay Control:

Like the typical progress bar, you can add the new progress bar control using the ToolBox Pane:

ToolBox

 

The new control offers full designer support as you would expect from a normal progress bar:

ProgressBarOverlay in Designer

 

Displaying Percentage:

Displaying Percentage

By default, the ProgressBarOverlay control displays the current percentage. This value is calculated using the progress bar’s Value and Maximum properties. As you step or directly modify the progress bar’s Value, the control will automatically update to reflect the current percentage.

Note: The percentage will not be displayed if the ProgressBar’s Style property is set to Marquee.

 

Displaying Alternate Text:

TextOverlay on ProgressBar

In certain cases you may want to display text instead of a percentage; particularly when using the Marquee style in instances where the progress is unknown. In order to display custom text, the ProgressBarOverlay control has a property called:

TextOverlay  

Set this property in order to display custom text over on the progress bar.

TextOverlay in Property Pane

 

The Custom Control in Exported Script:

PowerShell has the ability to compile C# code on demand by use the Add-Type cmdlet. This powerful feature allows us to create and utilize customs control directly in the exported script.

Defining the Custom Control with Add-Type

When the script is executed, it checks if the custom type is already defined. If the custom type is not defined, the script will call the Add-Type cmdlet to compile the code on demand. Once the type is defined, the script can instantiate and use the custom control:

Instantiating the Custom Control

 

For further help on using the progress bar, please refer to the Spotlight on the ProgressBar Control article.

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.