BinaryTreeListViewOffice2007ColorPickerColumn
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 | |
|---|---|
BinaryTreeListViewOffice2007ColorPickerColumn | Creates the column, with BinaryTreeListViewOffice2007ColorPickerCell as its cell template. |
| Properties | |
AlphaBlendFactorForControlPainting | Gets or sets how strongly the window colour shows in the picker's drop-down button at rest. |
AlphaBlendFactorForDropDownPressedColor | Gets or sets how strongly CustomPaintingColor shows in the picker's drop-down button when
pressed. |
AlphaBlendFactorForItemSelectionColor | Gets or sets how strongly CustomPaintingColor shows in the picker's drop-down button and
highlighted face. |
AlphaValue | Gets the alpha value of the colour most recently picked in any cell of the column. |
BlendTargetColor | Gets the blend colour of the colour most recently picked in any cell of the column, when the palette offers alpha blending. |
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. |
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. |
CustomColorForRectangleBorder | Gets or sets the colour of the frame the palette draws round the swatch the user clicks. |
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. |
CustomPaintingColor | Gets or sets the colour the picker's drop-down button and highlighted face are shaded from. |
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. |
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. |
EnableSettingAlphaValue | Gets or sets whether the palette shows the alpha slider and the "Blend with color" swatch. |
HeadingBackColor | Gets or sets the background of the palette's headings, its "More colors..." strip and its alpha panel. |
HeadingForeColor | Gets or sets the colour of the palette's heading text and labels. |
SelectedColor | Gets the colour most recently picked in any cell of the column. |
SelectedColorRectangleBorder | Gets or sets a colour handed to the palette for the frame round the clicked swatch. |
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. |
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. |
ShowDropDownButtonWhenCellNotInEditingMode | Gets or sets whether a cell that is not being edited shows the picker's drop-down button. |
ShowHSBInToolTip | Gets or sets whether the palette's tool tips add each colour's hue, saturation and brightness. |
ShowToolTip | Gets or sets whether pointing at a swatch in the palette shows its colour's name or RGB values. |
| Methods | |
Clone | Creates a copy of the column, including all its palette and drawing settings. |
Constructors
BinaryTreeListViewOffice2007ColorPickerColumn
Creates the column, with BinaryTreeListViewOffice2007ColorPickerCell as its cell template.
Properties
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
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
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 (
CustomPaintingColoritself). 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
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
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
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
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
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.Emptyleaves the picker's own colour.
Remarks
Copied to the picker each time an edit starts.
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.Emptyleaves the picker's own colour.
Remarks
Copied to the picker each time an edit starts.
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.Emptyleaves the picker's own colour.
Remarks
Copied to the picker each time an edit starts.
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
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
Gets or sets whether the palette shows the alpha slider and the "Blend with color" swatch.
- Value
trueto offer alpha blending; the default isfalse.
Remarks
Copied to the picker each time an edit starts, in place of the picker's own default.
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.Emptyleaves the picker's own colour.
Remarks
Copied to the picker each time an edit starts.
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.Emptyleaves the picker's own colour.
Remarks
Copied to the picker each time an edit starts.
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
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
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
truefor a constant border; the default istrue.
See also
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
trueto show names; the default isfalse.
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
Gets or sets whether a cell that is not being edited shows the picker's drop-down button.
- Value
trueto show the button; the default istrue.
Remarks
Applies only while the grid's
BinaryTreeListView.SpecialColumnCellsToDisplayEditingControlOnCellsAlways is on.
See also
ShowHSBInToolTip
Gets or sets whether the palette's tool tips add each colour's hue, saturation and brightness.
- Value
trueto add them; the default isfalse.
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
Gets or sets whether pointing at a swatch in the palette shows its colour's name or RGB values.
- Value
trueto show tool tips; the default isfalse.
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
Creates a copy of the column, including all its palette and drawing settings.