PowerShell Studio: ComboBox of Colors

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.

ComboBox - Colors control set

 

When you select the ComboBox – Colors control set, PowerShell Studio inserts a ComboBox that displays a list of colors:

Colors ComboBox

 

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:

Color Changed

 

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:

Spotlight on the ComboBox

Wondering why my form is black? Refer to this article:

PowerShell Studio: I see a gray form and I want it painted black!

 

Release Notes

You can view the complete service build log here.

 

Feedback

Please continue providing your feedback. Many of the new features included in the service builds are suggestions from users like you. Submit your suggestions or feature requests on the Wish List and Feature Requests forum or the Feature Requests page.