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

BinaryTreeListViewOffice2007ColorPickerCell

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

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
BinaryTreeListViewOffice2007ColorPickerCellCreates a cell. The column creates its cells from its template, so an application rarely calls this.
Properties
DefaultNewRowValueGets the value a cell starts with in the grid's row for new entries.
EditTypeGets the type of the editor the grid shows while the cell is edited.
ValueTypeGets the type of the value the cell holds.
Methods
InitializeEditingControlPrepares the grid's colour picker for this cell as an edit starts, setting its colour from the cell's value.
PaintPaints this cell. The base implementation draws the standard cell; this override adds the parts specific to BinaryTreeListViewOffice2007ColorPickerCell.

Constructors

BinaryTreeListViewOffice2007ColorPickerCell

public BinaryTreeListViewOffice2007ColorPickerCell() : base()

Creates a cell. The column creates its cells from its template, so an application rarely calls this.

Properties

DefaultNewRowValue

public override object 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.Empty before the first edit. A tree list view has no row for new entries, so this is rarely used.

EditType

public override Type 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

public override Type ValueType

Gets the type of the value the cell holds.

Value
object, so the cell can hold a Color, a string or an integer.

Methods

InitializeEditingControl

public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)

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

protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)

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.