BinaryTreeListViewOffice2007ColorPickerCell
A cell of a BinaryTreeListViewOffice2007ColorPickerColumn: it shows a colour as a swatch or a fill, and is edited in an Office-style
palette.
public class BinaryTreeListViewOffice2007ColorPickerCell : DataGridViewTextBoxCell
Inherits from / implements: DataGridViewTextBoxCell
Remarks
The column creates its cells from its template. Its value can be a Color, a string a
ColorConverter reads, such as "SteelBlue", or an integer ARGB value; an empty value
draws an empty swatch and no label.
Members at a glance
| Constructors | |
|---|---|
BinaryTreeListViewOffice2007ColorPickerCell | Creates a cell. The column creates its cells from its template, so an application rarely calls this. |
| Properties | |
DefaultNewRowValue | Gets the value a cell starts with in the grid's row for new entries. |
EditType | Gets the type of the editor the grid shows while the cell is edited. |
ValueType | Gets the type of the value the cell holds. |
| Methods | |
InitializeEditingControl | Prepares the grid's colour picker for this cell as an edit starts, setting its colour from the cell's value. |
Paint | Paints this cell. The base implementation draws the standard cell; this override adds the parts specific to BinaryTreeListViewOffice2007ColorPickerCell. |
Constructors
BinaryTreeListViewOffice2007ColorPickerCell
Creates a cell. The column creates its cells from its template, so an application rarely calls this.
Properties
DefaultNewRowValue
Gets the value a cell starts with in the grid's row for new entries.
- Value
- The colour the picker showed when this cell last prepared it, or
Color.Emptybefore the first edit. A tree list view has no row for new entries, so this is rarely used.
EditType
Gets the type of the editor the grid shows while the cell is edited.
- Value
- An internal type based on
BinaryOfficeColorPickerComboBox; the grid creates one and reuses it.
ValueType
Gets the type of the value the cell holds.
- Value
object, so the cell can hold aColor, a string or an integer.
Methods
InitializeEditingControl
Prepares the grid's colour picker for this cell as an edit starts, setting its colour from the cell's value.
Parameters
rowIndex- The grid row of the cell being edited.
initialFormattedValue- The cell's formatted value.
dataGridViewCellStyle- The cell's style. The palette's settings come from the column.
Remarks
A value that is not a colour, a colour string or an integer leaves the picker on the colour it showed last.
Paint
Paints this cell. The base implementation draws the standard cell; this override adds the parts specific to BinaryTreeListViewOffice2007ColorPickerCell.
Remarks
The value – a swatch and a label, or a fill with the label on it – is drawn on every row.
With BinaryTreeListView.SpecialColumnCellsToDisplayEditingControlOnCellsAlways
on, the row also shows the picker's chrome: a hairline box while the column's
BinaryTreeListViewOffice2007ColorPickerColumn.ShowBorderAlways is on, and
the drop-down button while its
BinaryTreeListViewOffice2007ColorPickerColumn.ShowDropDownButtonWhenCellNotInEditingMode
is – flat, or the classic push button when
BinaryTreeListViewOffice2007ColorPickerColumn.DrawStyleIsFlat is off.