HypernovaDesktop Components · docs
Binarymission
WinFormsTree List View › BinaryTreeListViewNumericUpDownCell

BinaryTreeListViewNumericUpDownCell

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

A specialist cell class that will host our custom control BinaryNumericUpDown control as its editing control.

public class BinaryTreeListViewNumericUpDownCell : DataGridViewTextBoxCell

Inherits from / implements: DataGridViewTextBoxCell

Members at a glance

BinaryTreeListViewNumericUpDownCellInitializes a new instance of the BinaryTreeListViewNumericUpDownCell class.
DecimalPlacesGets or sets the Decimal places for the control.
EditTypeGets the type of the control this cell uses for editing.
IncrementGets or sets the "increment" value for this control.
MaximumGets or sets the Maximum value for this control.
MinimumGets or sets the Minimum value for the control.
ThousandsSeparatorGets or sets the Thousands separator setting for the control.
ValueTypeGets the type of the value this cell holds.
CloneCreates a copy of this BinaryTreeListViewNumericUpDownCell, carrying across every setting this type adds to the base implementation.
DetachEditingControlDetaches the editing control from the grid when editing finishes.
GetErrorIconBoundsReturns where the cell's error icon is drawn, adjusted for the extra chrome this cell type paints.
GetFormattedValueFormats the cell value for display, applying the spinner's decimal places and thousands separator rather than the grid's default numeric formatting.
GetPreferredSizeReturns the size this BinaryTreeListViewNumericUpDownCell would like to be for the given constraint.
InitializeEditingControlPrepares the editing control that this cell hands to the grid, pushing the cell's own settings onto it before editing starts.
KeyEntersEditModeReports whether a key press should start editing this cell. Digits, the sign and the decimal separator do; other characters do not.
PaintPaints this cell. The base implementation draws the standard cell; this override adds the parts specific to BinaryTreeListViewNumericUpDownCell.
PositionEditingControlPositions the editing control within the cell.
ToStringReturns a short description of this BinaryTreeListViewNumericUpDownCell, which is what the designer shows for the property.

Constructors

BinaryTreeListViewNumericUpDownCell

public BinaryTreeListViewNumericUpDownCell()

Initializes a new instance of the BinaryTreeListViewNumericUpDownCell class.

Properties

DecimalPlaces

public int DecimalPlaces

Gets or sets the Decimal places for the control.

EditType

public override Type EditType

Gets the type of the control this cell uses for editing.

Increment

public Decimal Increment

Gets or sets the "increment" value for this control.

Maximum

public Decimal Maximum

Gets or sets the Maximum value for this control.

Minimum

public Decimal Minimum

Gets or sets the Minimum value for the control.

ThousandsSeparator

public bool ThousandsSeparator

Gets or sets the Thousands separator setting for the control.

ValueType

public override Type ValueType

Gets the type of the value this cell holds.

Methods

Clone

public override object Clone()

Creates a copy of this BinaryTreeListViewNumericUpDownCell, carrying across every setting this type adds to the base implementation.

DetachEditingControl

public override void DetachEditingControl()

Detaches the editing control from the grid when editing finishes.

GetErrorIconBounds

protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)

Returns where the cell's error icon is drawn, adjusted for the extra chrome this cell type paints.

GetFormattedValue

protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)

Formats the cell value for display, applying the spinner's decimal places and thousands separator rather than the grid's default numeric formatting.

value
The value held by the cell.
rowIndex
The row this cell belongs to.
cellStyle
The style in force, which may be adjusted.
valueTypeConverter
A converter for the stored type, if any.
formattedValueTypeConverter
A converter for the display type, if any.
context
Why the value is being formatted.

Returns. The value as it is to be displayed.

GetPreferredSize

protected override Size GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize)

Returns the size this BinaryTreeListViewNumericUpDownCell would like to be for the given constraint.

InitializeEditingControl

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

Prepares the editing control that this cell hands to the grid, pushing the cell's own settings onto it before editing starts.

KeyEntersEditMode

public override bool KeyEntersEditMode(KeyEventArgs e)

Reports whether a key press should start editing this cell. Digits, the sign and the decimal separator do; other characters do not.

e
The key that was pressed.

Returns. true when the key should begin an edit.

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 BinaryTreeListViewNumericUpDownCell.

With SpecialColumnCellsToDisplayEditingControlOnCellsAlways on, a row that is not being edited shows the spinner's chrome beside its value. With the column's DrawStyleIsFlat on - its default - that is a flat pair of chevrons in the column's colours, inside a hairline box when ShowBorderAlways is on. Off, it is the classic 3D spinner picture. Until 2026-09 the picture was drawn whatever DrawStyleIsFlat said: the flat style and every colour on the column reached the one row being edited and no other, and the value was drawn across the whole cell with the picture laid over its right-hand end (HANDOVER 3av).

PositionEditingControl

public override void PositionEditingControl(bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow)

Positions the editing control within the cell.

ToString

public override string ToString()

Returns a short description of this BinaryTreeListViewNumericUpDownCell, which is what the designer shows for the property.