Skip to main content

VisColorPalette

Namespace: PPJ.Runtime.Vis

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

Exposes SAL color and command operations for a selectable color palette.

public class VisColorPalette : VisColorPaletteBase

Example:

using (var palette = new PPJ.Runtime.Vis.VisColorPalette())
{
int index = palette.Colors.Add(System.Drawing.Color.Red);
palette.SetFocus(index);
}

Constructors

Instance member VisColorPalette()

Initializes a new instance of VisColorPalette.

Methods

Instance member AddMenu(szText, nID)

Appends a palette button and attempts to assign its caption and identifier.

ParameterTypeDescription
szTextSalStringThe requested caption.
nIDSalNumberThe requested command identifier.

Returns: SalNumber. The value returned by Buttons.Add if the subsequent assignments succeed.

Buttons.Add returns the new count, which this method uses as an index. The current implementation therefore accesses past the end after appending the button.

Instance member ClearMenu()

Removes palette buttons after the first button.

Returns: SalBoolean. True.

The button at index zero is retained.

Static member FromHandle(handle)

Resolves a palette from a native window handle.

ParameterTypeDescription
handleSalWindowHandleThe native control handle.

Returns: VisColorPalette. The VisColorPalette, or null if no managed control owns the handle.

A different managed control type causes InvalidCastException.

Instance member GetColor(nEntry)

Gets a palette color as a Win32 color value.

ParameterTypeDescription
nEntrySalNumberThe zero-based color index.

Returns: SalNumber. The color value, or zero for an invalid index.

Instance member GetColors(nColors)

Copies all palette colors into a SAL array.

ParameterTypeDescription
nColorsSalArray<SalNumber>The non-null array to make dynamic, reset, and fill from index zero with Win32 color values.

Returns: SalNumber. The output array count.

Instance member GetFocus()

Gets the selected palette index.

Returns: SalNumber. The stored zero-based selection index.

Instance member GetMenu(nEntry, sText, nID)

Gets the caption and identifier of a palette button.

ParameterTypeDescription
nEntrySalNumberThe menu entry offset; the underlying button index is nEntry + 1.
sText by referenceSalStringReceives the caption; unchanged if the computed index is invalid.
nID by referenceSalNumberReceives the identifier; unchanged if the computed index is invalid.

Returns: SalNumber. One when found; otherwise, zero.

Instance member GetMenuAll(sText, nID)

Copies button captions and identifiers, skipping button zero.

ParameterTypeDescription
sTextSalArray<SalString>The non-null caption array to make dynamic and reset.
nIDSalArray<SalNumber>The non-null identifier array to make dynamic and reset.

Returns: SalNumber. The identifier array count.

Values are written at their button indices starting at one; element zero remains the default value when the arrays grow.

Instance member InsertMenu(nEntry, szText, nID)

Inserts a palette command button.

ParameterTypeDescription
nEntrySalNumberThe menu entry offset; the underlying button index is nEntry + 1.
szTextSalStringThe button caption.
nIDSalNumberThe button command identifier.

Returns: SalBoolean. True when the computed index is valid; otherwise, false.

Instance member RemoveMenu(nEntry)

Removes a palette command button.

ParameterTypeDescription
nEntrySalNumberThe menu entry offset; the underlying button index is nEntry + 1.

Returns: SalBoolean. True when the computed index is valid; otherwise, false.

Instance member SetColor(nEntry, nColor)

Replaces an existing palette color.

ParameterTypeDescription
nEntrySalNumberThe zero-based color index.
nColorSalNumberThe SAL color value.

Returns: SalNumber. The previous SAL color, or zero when the index is invalid.

Instance member SetColors(nColors)

Appends colors to the palette.

ParameterTypeDescription
nColorsSalArray<SalNumber>The non-null array of SAL colors to append.

Returns: SalNumber. The number of supplied colors.

Existing colors are retained.

Instance member SetFocus(nEntry)

Selects an existing color entry.

ParameterTypeDescription
nEntrySalNumberThe zero-based color index.

Returns: SalBoolean. True for a valid index; otherwise, false.

Instance member SetMenu(nEntry, szText, nID)

Updates a palette command button.

ParameterTypeDescription
nEntrySalNumberThe menu entry offset; the underlying button index is nEntry + 1.
szTextSalStringThe button caption.
nIDSalNumberThe button command identifier.

Returns: SalBoolean. True when the computed index is valid; otherwise, false.

Instance member SetMenuAll(sText, nID)

Appends command buttons from corresponding text and identifier arrays.

ParameterTypeDescription
sTextSalArray<SalString>The zero-based caption array.
nIDSalArray<SalNumber>The zero-based identifier array with the same count.

Returns: SalNumber. Zero for differing counts; otherwise, the caption count if all AddMenu calls complete.

Uses AddMenu, including its current count-as-index behavior. Existing buttons are retained.

Implements

NameDescription
ISalWindow