Class

DesktopColorPicker

Color Picker

ColorPicker


Description

Displays the operating system's color picker.

Properties

Name

Type

Read-Only

Shared

HasAlpha

Boolean

IsVisible

Boolean

Methods

Name

Parameters

Returns

Shared

Close

Handle

Ptr

Show

initialColor As Color, prompt As String, left As Integer = 0, top As Integer = 0, width As Integer = 230, height As Integer = 415

Events

Name

Parameters

Returns

Closed

ColorSelected

selectedColor As Color

Property descriptions


DesktopColorPicker.HasAlpha

HasAlpha As Boolean

If True, the color selected will be returned with an alpha channel.

The default value is True.


DesktopColorPicker.IsVisible

IsVisible As Boolean

If True, the Color Picker is visible.

The default value is False.

This property is read-only.

Method descriptions


DesktopColorPicker.Close

Close

Closes the DesktopColorPicker window.


DesktopColorPicker.Handle

Handle As Ptr

Returns a Ptr for use with declares.


DesktopColorPicker.Show

Show(initialColor As Color, prompt As String, left As Integer = 0, top As Integer = 0, width As Integer = 230, height As Integer = 415)

Displays the operating system's color picker using the color, prompt, location and size passed.

On macOS, once your app displays the Color Picker, the OS will continue to show it at that size regardless of what you pass as the width and height.

The Prompt, Left, Top, Width and Height parameters are only supported on macOS.

Additionally, on macOS should you have a DesktopTextArea on the layout in which you open the DesktopColorPicker and should that DesktopTextArea have the focus, the DesktopColorPicker will automatically set the color of the selection. This is simply how the DesktopColorPicker works on macOS. The workaround is to set first set the focus to the control that is calling the Show method:

Self.SetFocus
ColorPicker1.Show(Color.Black, "Choose a color:")

Event descriptions


DesktopColorPicker.Closed

Closed

The color picker has been closed.


DesktopColorPicker.ColorSelected

ColorSelected(selectedColor As Color)

The user selected the color passed.

Notes

On Windows and Linux, the operating system's color picker window is modal. On macOS, the color picker is not modal. This means that on macOS, the ColorSelected event will fire every time the user clicks on a color.

On macOS, if the Color Picker was left open when the user quit your app, it will be automatically closed upon relaunch.

Compatibility

Project Types

Desktop

Operating Systems

All

See also

Object parent class; Color class.