Class
DesktopColorPicker
Color Picker
ColorPicker
Description
Displays the operating system's color picker.
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
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 |
---|---|---|
selectedColor As Color |
Property descriptions
DesktopColorPicker.HasAlpha
HasAlpha As Boolean
DesktopColorPicker.IsVisible
IsVisible As Boolean
Method descriptions
DesktopColorPicker.Close
Close
Closes the DesktopColorPicker window.
DesktopColorPicker.Handle
Handle As Ptr
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.