Skip to content


Inherits DesktopCanvas


This class draws the colour swatches available for selection for a given colour shade dot in the XUIColorPicker.


Name Type Read-Only
mDidMouseDownOverSwatch Boolean
mPalette() Pair
mSelectedIndex Integer
mShouldRecomputeBounds Boolean
mSwatchBorderColor ColorGroup
mSwatchHeight Integer
mSwatchVerticalPadding Integer
SelectedColor Color
SelectedIndex Integer
SwatchHeight Integer
SwatchVerticalPadding Integer


Name Parameters Returns
AddColor c As Color, shouldRefresh As Boolean
AddColors colours() As Color
ComputeBounds g As Graphics


Name Parameters Returns
PressedSwatch selectedColor As Color


Name Type

SELECTION_DOT_DIAMETER As Double The diameter of the dot drawn in the centre of the selected swatch.

Property Descriptions

mDidMouseDownOverSwatch As Boolean

True if the user clicked a colour swatch during the last MouseDown event.

mPalette() As Pair

The colours to draw as swatches. Left = Color, Right = Bounds.

mSelectedIndex As Integer

The currently selected swatch index.

mShouldRecomputeBounds As Boolean

If True then the bounds of the swatches in the palette will be recomputed during the next Paint event.

mSwatchBorderColor As ColorGroup

The colour to use for the border of the swatches.

mSwatchHeight As Integer

The height of a swatch.

mSwatchVerticalPadding As Integer

The amount of padding between swatches.

SelectedColor As Color

The currently selected colour.

SelectedIndex As Integer

The index of the currently selected swatch.

SwatchHeight As Integer

The height of a swatch.

SwatchVerticalPadding As Integer

The amount of padding between swatches.

Method Descriptions

AddColor(c As Color, shouldRefresh As Boolean)

Adds a new colour to the canvas. By default the canvas is refreshed.

AddColors(colours() As Color)

Adds multiple colours to the canvas. The canvas is automatically refreshed.

ComputeBounds(g As Graphics)

Computes the bounds of each of the colour swatches


Default constructor.


Removes all colours from the canvas.

Event Descriptions

PressedSwatch(selectedColor As Color) The user clicked a colour swatch.