ComboBox of Colors
- Details
- Written by David Corrales
- Last Updated: 09 October 2019
- Created: 13 June 2019
- Hits: 10168
The PowerShell Studio v5.6.164 service build introduces a new ComboBox control set:
ComboBox – Colors
This control is useful when you need to provide the user with a color choice.
When you select the ComboBox – Colors control set, PowerShell Studio inserts a ComboBox that displays a list of colors:
Each item represents a System.Drawing.Color type and includes a preview of the color. When a user selects a color from the pull down, the ComboBox's SelectedItem property will contains the selected Color object:
$comboboxColors_SelectedIndexChanged={
#Get the selected color
$color = $comboboxColors.SelectedItem
if ($color)
{
#Apply the color to the RichTextBox
$richtextbox1.SelectionColor = $color
$richtextbox1.AppendText("Selected: $color `r`n")
}
}
In this example, the color name is displayed in the RichTextBox using the selected color:
Note: This control set was inspired by a user's post on our PowerShell GUIs forum. Please let us know what you think.
Related Articles:
Wondering why my form is black? Refer to this article:
PowerShell Studio: I see a gray form and I want it painted black!
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.