HypernovaDesktop Components · docs
Binarymission
WinForms › Tree List View › BinaryTreeListViewOffice2007ColorPickerColumn

BinaryTreeListViewOffice2007ColorPickerColumn

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.TreeControls

A BinaryTreeListView column of colours, each edited in an Office-style palette that drops down from the cell.

public class BinaryTreeListViewOffice2007ColorPickerColumn : DataGridViewColumn

Inherits from / implements: DataGridViewColumn

Remarks

Each cell shows its colour as a swatch beside its name or RGB values, or as a fill with the label on it (ColorPickerCellDrawingStyle). A cell's value can be a Color, a string such as "SteelBlue" or "70, 130, 180", or an integer ARGB value. After the user picks a colour the cell holds the picker's text.

The palette's look comes from the column: its settings are copied to the picker each time an edit starts. They default to the picker's own defaults, and a colour left at Color.Empty keeps the picker's own colour.

Examples

A status-colour column in a task tree, with the palette in the picker's usual colours.

var status = new BinaryTreeListViewOffice2007ColorPickerColumn
{
    HeaderText = "Colour",
    ColorPickerCellDrawingStyle = ColorPickerCellDrawingStyle.ColorRectangleAndValue,
    ShowColorNameIfKnownColor = true,
    ShowToolTip = true,
    HeadingBackColor = Color.FromArgb(204, 219, 230),
    HeadingForeColor = SystemColors.WindowText,
    CustomPaintingColor = SystemColors.Highlight,
    CustomControlBorderColor = SystemColors.Highlight,
    AlphaBlendFactorForItemSelectionColor = 70
};
treeListView.Columns.Add(status);           // after the tree column

treeListView.Nodes.Add("Design review", Color.SteelBlue);

See also

Members at a glance

Constructors
BinaryTreeListViewOffice2007ColorPickerColumnCreates the column, with BinaryTreeListViewOffice2007ColorPickerCell as its cell template.
Properties
AlphaBlendFactorForControlPaintingGets or sets how strongly the window colour shows in the picker's drop-down button at rest.
AlphaBlendFactorForDropDownPressedColorGets or sets how strongly CustomPaintingColor shows in the picker's drop-down button when pressed.
AlphaBlendFactorForItemSelectionColorGets or sets how strongly CustomPaintingColor shows in the picker's drop-down button and highlighted face.
AlphaValueGets the alpha value of the colour most recently picked in any cell of the column.
BlendTargetColorGets the blend colour of the colour most recently picked in any cell of the column, when the palette offers alpha blending.
BorderColorGets or sets the colour of the hairline box round a cell's value, and of the line round the palette unless DropDownBorderColor is set.
ColorPickerCellDrawingStyleGets or sets how a cell that is not being edited shows its colour: a swatch beside its label, or the cell filled with the colour and the label on it.
CustomColorForRectangleBorderGets or sets the colour of the frame the palette draws round the swatch the user clicks.
CustomControlBorderColorGets or sets the colour of the picker's border while it has the focus or the pointer is over it, and the outline of its drop-down button.
CustomPaintingColorGets or sets the colour the picker's drop-down button and highlighted face are shaded from.
DrawStyleIsFlatGets or sets whether a cell that is not being edited draws its drop-down button flat – a chevron, inside a hairline box when ShowBorderAlways is on – or as the classic themed push button.
DropDownBorderColorGets or sets the colour of the border round the palette that drops down from a cell being edited, or Color.Empty to use BorderColor.
EnableSettingAlphaValueGets or sets whether the palette shows the alpha slider and the "Blend with color" swatch.
HeadingBackColorGets or sets the background of the palette's headings, its "More colors..." strip and its alpha panel.
HeadingForeColorGets or sets the colour of the palette's heading text and labels.
SelectedColorGets the colour most recently picked in any cell of the column.
SelectedColorRectangleBorderGets or sets a colour handed to the palette for the frame round the clicked swatch.
ShowBorderAlwaysGets or sets whether the picker's border and drop-down button are drawn in their highlighted colours all the time, and whether rows not being edited show a hairline box round the value.
ShowColorNameIfKnownColorGets or sets whether a cell shows a colour's name, such as "SlateGray", instead of its red, green and blue values when the colour has one.
ShowDropDownButtonWhenCellNotInEditingModeGets or sets whether a cell that is not being edited shows the picker's drop-down button.
ShowHSBInToolTipGets or sets whether the palette's tool tips add each colour's hue, saturation and brightness.
ShowToolTipGets or sets whether pointing at a swatch in the palette shows its colour's name or RGB values.
Methods
CloneCreates a copy of the column, including all its palette and drawing settings.

Constructors

BinaryTreeListViewOffice2007ColorPickerColumn

public BinaryTreeListViewOffice2007ColorPickerColumn() : base()

Creates the column, with BinaryTreeListViewOffice2007ColorPickerCell as its cell template.

Properties

AlphaBlendFactorForControlPainting

public int AlphaBlendFactorForControlPainting

Gets or sets how strongly the window colour shows in the picker's drop-down button at rest.

Value
From 0 to 255. The default is 195, as for the picker on its own.
Remarks

Copied to the picker each time an edit starts.

AlphaBlendFactorForDropDownPressedColor

public int AlphaBlendFactorForDropDownPressedColor

Gets or sets how strongly CustomPaintingColor shows in the picker's drop-down button when pressed.

Value
From 0 to 255. The default is 70, as for the picker on its own.
Remarks

Copied to the picker each time an edit starts.

AlphaBlendFactorForItemSelectionColor

public int AlphaBlendFactorForItemSelectionColor

Gets or sets how strongly CustomPaintingColor shows in the picker's drop-down button and highlighted face.

Value
From 0 (plain window colour) to 255 (CustomPaintingColor itself). The default is 70, as for the picker on its own.
Remarks

Copied to the picker each time an edit starts, in place of the picker's own default.

AlphaValue

public int AlphaValue

Gets the alpha value of the colour most recently picked in any cell of the column.

Value
From 0 to 255. The default is 0.
Remarks

The picker writes it back each time the user picks a colour. Setting it changes nothing: it is not passed to the picker.

See also

BlendTargetColor

public Color BlendTargetColor

Gets the blend colour of the colour most recently picked in any cell of the column, when the palette offers alpha blending.

Value
The default is Color.Empty.
Remarks

The picker writes it back each time the user picks a colour. Setting it changes nothing: it is not passed to the picker.

See also

BorderColor

public Color BorderColor

Gets or sets the colour of the hairline box round a cell's value, and of the line round the palette unless DropDownBorderColor is set.

Value
The default is SystemColors.ActiveBorder.
Remarks

The box is drawn on rows not being edited while ShowBorderAlways, DrawStyleIsFlat and the grid's BinaryTreeListView.SpecialColumnCellsToDisplayEditingControlOnCellsAlways are all on.

See also

ColorPickerCellDrawingStyle

public ColorPickerCellDrawingStyle ColorPickerCellDrawingStyle

Gets or sets how a cell that is not being edited shows its colour: a swatch beside its label, or the cell filled with the colour and the label on it.

Value
The default is ColorPickerCellDrawingStyle.ColorRectangleAndValue.
Remarks

With the fill, the label is drawn in black or white, whichever reads better on the colour, and includes the alpha value, as in (128) 70, 130, 180.

See also

CustomColorForRectangleBorder

public Color CustomColorForRectangleBorder

Gets or sets the colour of the frame the palette draws round the swatch the user clicks.

Value
The default is Color.Yellow, as for the picker on its own. Color.Empty leaves the picker's own colour.
Remarks

Copied to the picker each time an edit starts.

CustomControlBorderColor

public Color CustomControlBorderColor

Gets or sets the colour of the picker's border while it has the focus or the pointer is over it, and the outline of its drop-down button.

Value
The default is SystemColors.Highlight, as for the picker on its own. Color.Empty leaves the picker's own colour.
Remarks

Copied to the picker each time an edit starts.

CustomPaintingColor

public Color CustomPaintingColor

Gets or sets the colour the picker's drop-down button and highlighted face are shaded from.

Value
The default is SystemColors.Highlight, as for the picker on its own. Color.Empty leaves the picker's own colour.
Remarks

Copied to the picker each time an edit starts.

DrawStyleIsFlat

public bool DrawStyleIsFlat

Gets or sets whether a cell that is not being edited draws its drop-down button flat – a chevron, inside a hairline box when ShowBorderAlways is on – or as the classic themed push button.

Default
true
Remarks

Applies while the grid's BinaryTreeListView.SpecialColumnCellsToDisplayEditingControlOnCellsAlways is on, which is when a cell shows its editor's chrome at all. The default is true, the same as BinaryTreeListViewNumericUpDownColumn.DrawStyleIsFlat, so the three special columns match.

DropDownBorderColor

public Color DropDownBorderColor

Gets or sets the colour of the border round the palette that drops down from a cell being edited, or Color.Empty to use BorderColor.

Remarks

BorderColor is the hairline round a cell's value, and a hairline colour meant to sit quietly among the grid's rules is lost round a palette that opens over them. This gives the palette a border of its own. The default, Empty, keeps the palette in BorderColor.

EnableSettingAlphaValue

public bool EnableSettingAlphaValue

Gets or sets whether the palette shows the alpha slider and the "Blend with color" swatch.

Value
true to offer alpha blending; the default is false.
Remarks

Copied to the picker each time an edit starts, in place of the picker's own default.

HeadingBackColor

public Color HeadingBackColor

Gets or sets the background of the palette's headings, its "More colors..." strip and its alpha panel.

Value
The default is a pale blue-grey, RGB (204, 219, 230), as for the picker on its own. Color.Empty leaves the picker's own colour.
Remarks

Copied to the picker each time an edit starts.

HeadingForeColor

public Color HeadingForeColor

Gets or sets the colour of the palette's heading text and labels.

Value
The default is SystemColors.WindowText, as for the picker on its own. Color.Empty leaves the picker's own colour.
Remarks

Copied to the picker each time an edit starts.

SelectedColor

public Color SelectedColor

Gets the colour most recently picked in any cell of the column.

Value
The default is Color.Empty.
Remarks

The picker writes it back each time the user picks a colour. It is not the colour of any one cell – read the cell's value for that – and setting it changes nothing.

See also

SelectedColorRectangleBorder

public Color SelectedColorRectangleBorder

Gets or sets a colour handed to the palette for the frame round the clicked swatch.

Value
The default is Color.Empty, which leaves the picker's own.
Remarks

The palette replaces it with CustomColorForRectangleBorder each time it opens, so set that property instead.

ShowBorderAlways

public bool ShowBorderAlways

Gets or sets whether the picker's border and drop-down button are drawn in their highlighted colours all the time, and whether rows not being edited show a hairline box round the value.

Value
true for a constant border; the default is true.
See also

ShowColorNameIfKnownColor

public bool ShowColorNameIfKnownColor

Gets or sets whether a cell shows a colour's name, such as "SlateGray", instead of its red, green and blue values when the colour has one.

Value
true to show names; the default is false.
Remarks

In a cell that is not being edited, a colour whose value is that of a named web colour shows the name – Color.FromArgb(112, 128, 144) shows "SlateGray" – whether or not it was created from the name, since a colour read back from a database or a designer file never is. Any other colour shows its red, green and blue.

ShowDropDownButtonWhenCellNotInEditingMode

public bool ShowDropDownButtonWhenCellNotInEditingMode

Gets or sets whether a cell that is not being edited shows the picker's drop-down button.

Value
true to show the button; the default is true.
Remarks
See also

ShowHSBInToolTip

public bool ShowHSBInToolTip

Gets or sets whether the palette's tool tips add each colour's hue, saturation and brightness.

Value
true to add them; the default is false.
Remarks

The palette reads it when it first loads, so a change may not show until the next time the grid creates its editor.

ShowToolTip

public bool ShowToolTip

Gets or sets whether pointing at a swatch in the palette shows its colour's name or RGB values.

Value
true to show tool tips; the default is false.
Remarks

The palette reads it when it first loads, so a change may not show until the next time the grid creates its editor.

Methods

Clone

public override object Clone()

Creates a copy of the column, including all its palette and drawing settings.

Returns