Skip to main content

VisColorPaletteBase

Namespace: PPJ.Runtime.Vis

Assembly: PPJ.Runtime.Vis.50 (5.0.0.0)

Provides a selectable color grid and optional palette command buttons.

public class VisColorPaletteBase : SalUserControl

Example:

void SelectRed(PPJ.Runtime.Vis.VisColorPaletteBase palette)
{
int index = palette.Colors.Add(System.Drawing.Color.Red);
palette.SelectedIndex = index;
}

Constructors

Instance member VisColorPaletteBase()

Initializes the color grid and palette button panel.

Properties

Instance member Buttons

PaletteButtonCollection: Gets the palette command-button collection.

Instance member Colors

ColorCollection: Gets the mutable palette color collection.

Instance member PreferredSize

Size: Gets the size for an eight-column palette including buttons, padding, and border.

When no color rows exist, returns the current control size.

Instance member SelectedColor

Color: Gets or selects a color from the palette.

The setter selects the first equal color. A color absent from Colors resolves to -1 and can cause the SelectedIndex setter to throw. The getter requires a valid selected index.

Instance member SelectedIndex

Int32: Gets or sets the selected color index. (Default: 0)

Changing the index refreshes the control and raises SelectedIndexChanged. Negative values and values greater than Count are rejected; Count itself is accepted even though it is not a valid color index.

Methods

Protected member OnButtonClicked(sender, e)

Raises ButtonClicked, posts SAM_Click with the button identifier, and handles the custom-color button.

ParameterTypeDescription
senderObjectThe PaletteButton that was clicked.
eEventArgsThe click event data.

Protected member OnFontChanged(e)

Scales color cells from the default 8.25-point font size and refreshes the layout.

ParameterTypeDescription
eEventArgsThe font-change event data.

Protected member OnGotFocus(e)

Raises the base event and moves focus to the color grid.

ParameterTypeDescription
eEventArgsThe focus event data.

Protected member OnResize(e)

Raises the base event, lays out the color grid, and refreshes the palette.

ParameterTypeDescription
eEventArgsThe resize event data.

Protected member OnSelectedIndexChanged(e)

Raises SelectedIndexChanged.

ParameterTypeDescription
eEventArgsThe selection event data.

Protected member ProcessCmdKey(msg, keyData)

Handles arrow-key color navigation and Space activation within the palette.

ParameterTypeDescription
msg by referenceMessageThe keyboard message.
keyDataKeysThe key and modifier flags.

Returns: Boolean. True for a handled palette command; otherwise, the base result.

Up from the first command button returns focus to the color grid.

Events

Instance member ButtonClicked

EventHandler Occurs when a palette command button is clicked.

Instance member SelectedIndexChanged

EventHandler Occurs after the selected color index changes.

Inherited By

NameDescription
VisColorPaletteExposes SAL color and command operations for a selectable color palette.

Implements

NameDescription
ISalWindow