The PowerShell Studio v5.6.164 service build introduces a new ComboBox control set:
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.
Wondering why my form is black? Refer to this article:
PowerShell Studio: I see a gray form and I want it painted black!