Archive for the ‘Spotlight on Controls’ Category


 

Spotlight on the Label Control

Wednesday, December 16th, 2015 by June Blender
The Spotlight on Controls series describes the controls, that is, the objects in the System.Windows.Forms namespace, so you can use them effectively when building GUI apps in PowerShell Studio and PrimalScript. Each post focuses on one control and lists its most important properties, methods, and events, including the default event that PowerShell Studio adds to your script when you double-click the control. The posts include many examples written in Windows PowerShell, so you can use them right away. Read more: Spotlight on Controls: Common properties and methods This post describes the Label control. Label Control [System.Windows.Forms.Label] Creates a clickable text…   More »

PowerShell GUIs: Where do I start?

Thursday, July 16th, 2015 by June Blender
Follow @juneb_get_help I've been using Windows PowerShell since the very first version of Monad in 2005, but PowerShell-based applications with a graphic user interface (GUI) are a whole new world. Instead of thinking of cmdlets and parameters or properties and methods, you need to think in object events. And because there's no console with .ps1xml-directed views, you need manage all output streams, including standard output and errors. Most importantly, because you're dealing with real users, you need to assume that people will type and click whatever they please in whatever order you let them. It reminds me of turning the…   More »

PowerShell Studio: Knowing when to use STA mode

Monday, March 9th, 2015 by David Corrales
Follow @SAPIENDavid Recently, on our forums, a user asked why certain controls didn’t function correctly or threw an error when he unchecked the STA option in PowerShell Studio. STA (Single Threaded Apartment) and MTA (Multi-Threaded Apartment) determine how a process manages legacy COM objects and their communication with multiple threads. I will not go into the detail, but you need not concern yourself with the inner workings of COM objects, other than to remember that STA is required for some of the GUI controls to function correctly. If you're interested in the details, see Processes, Threads, and Apartments in the…   More »

PowerShell Studio: Initializing my GUI controls

Tuesday, August 5th, 2014 by David Corrales
If you are working with a GUI script within PowerShell Studio and find that you need to edit the exported script to modify the control’s initialization, then you are doing something wrong. Don’t get me wrong, modifying and initialization of control properties is not the issue; in fact that it part of writing a GUI. What I’m referring to is the part where you are editing the exported scripts. If you are editing the exported script: 1. You are creating an extra step which means you need to export and modify the script anytime you make a change to the…   More »

Spotlight on the ToolTip Control

Thursday, January 30th, 2014 by David Corrales
The Spotlight on Controls series describes the controls, that is, the objects in the System.Windows.Forms namespace, so you can use them effectively when building GUI apps in PowerShell Studio and PrimalScript. Each post focuses on one control and lists its most important properties, methods, and events, including the default event that PowerShell Studio adds to your script when you double-click the control. The posts include many examples written in Windows PowerShell, so you can use them right away. Read more: Spotlight on Controls: Common properties and methods This post describes the ToolTip control. ToolTip [System.Windows.Forms.ToolTip] Represents a small rectangular pop-up…   More »

New Control Set: TextBox – Watermark

Wednesday, August 14th, 2013 by David Corrales
Recently in the forums we had a request on how to create a textbox with a watermark. What is a textbox with a watermark you ask? It is a textbox that displays hint information within the textbox using a lighter color. For example, a textbox that accepts a username, may have a watermark as follows: Once a user types in the textbox, the watermark goes away. Typically a C# developer would create this control by creating a new class that inherits the original textbox control. Next they would override some paint events and add custom members to keep track of…   More »

Spotlight on Controls: The Versatile Tag Property

Thursday, May 23rd, 2013 by David Corrales
You may not be aware that each WinForm Control has a Tag property which can be very useful in certain circumstances. Why use the Tag Property? Use the Tag property when you need to associate an object or store state information to a particular control. This ability to assign any object to the property, be it a control, value, psobject or scriptblock, is what makes the property so versatile. Below are examples demonstrating how the Tag property can be used in GUI scripts.   Example 1: The Tic Tac Plebius PowerShell game is a good example of how the Tag…   More »

Spotlight on the StatusStrip Control

Wednesday, September 12th, 2012 by David Corrales
The “Spotlight on Controls” series focuses on a single WinForms control in PowerShell Studio 2012, details the important Properties, Methods, and Events of the control and demonstrates how to utilize the control. Most of the information about the controls is still applicable to previous versions of PrimalForms. Note: The StatusStrip control is only available for PowerShell Studio 2012 v3.0.6 or greater Last time we took a look at the StatusBar control. This time we will look at the StatusStrip control: StatusStrip[System.Windows.Forms.StatusStrip] Represents a Windows status bar control. Default Event: ItemClick Why use a StatusStrip control? Use the StatusStrip control, to…   More »

WinForms Interactive Reference Guide for PowerShell

Thursday, September 6th, 2012 by David Corrales
Not long ago we released the WinForms Control Reference for PowerShell. We have taken the Reference a step further by creating an interactive version! The Interactive Reference allows you to display help information by clicking on a control in the Toolbox: For those of you who like reading on paper, you have the option to print the reference page: Easy access to the Spotlight on Control Blog Articles using Help Menu:   How do I download the WinForms Interactive Reference? The WinForms Interactive Reference is available only to registered users. To download,  log onto your MySAPIEN account and click on…   More »

PowerShell Studio: New ProgressBar Control

Monday, August 27th, 2012 by David Corrales
In the last service release of PowerShell Studio 2012 (v3.0.8) a new custom control called ProgressBarOverlay was introduced. This new 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:   The new control offers full designer support as you would expect from a normal progress bar:   Displaying Percentage: By default, the ProgressBarOverlay control displays the current percentage. This value is calculated using the progress bar’s…   More »