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

BinaryTreeListViewCell

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

The cell of the tree column: a text cell that also draws the node's indent, connecting lines, expand glyph and image or check box, and turns clicks on them into tree actions.

public class BinaryTreeListViewCell : DataGridViewTextBoxCell

Inherits from / implements: DataGridViewTextBoxCell

Remarks

Every cell of a BinaryTreeListViewColumn is one of these; there is no need to create them yourself. The cell is laid out from the left: one indent step (20 logical pixels) per level, with the expand glyph in the last step; then the image, check box or radio button; then the text, which edits like any text cell.

A click on the cell raises BinaryTreeListView.BinaryTreeListViewCellClicked, saying which of those parts was clicked, before the control acts on it.

See also

Members at a glance

Constructors
BinaryTreeListViewCellCreates a tree cell. A BinaryTreeListViewColumn creates its cells itself.
Methods
OnKeyDownHandles a key pressed while the cell has the focus: with BinaryTreeListView.ExpandCollapsingOfNodesLevel set to ExpandCollapsingOfNodesLevel.TreeListViewCell, Shift+Right opens the node and Shift+Left closes it.
OnLeaveHandles the focus leaving the cell, restoring the control's BinaryTreeListView.CellEditingMode.
OnMouseDownHandles a mouse press on the cell: works out which part was pressed, raises BinaryTreeListView.BinaryTreeListViewCellClicked, and then, unless a handler cancelled it, opens or closes the node, changes its check box, or lets the press select the text.
OnMouseUpHandles the mouse button being released over the cell, ending the control's handling of the click.
PaintPaints the cell: its text, then the node's image or check box, the connecting lines and the expand glyph.

Constructors

BinaryTreeListViewCell

public BinaryTreeListViewCell()

Creates a tree cell. A BinaryTreeListViewColumn creates its cells itself.

Methods

OnKeyDown

protected override void OnKeyDown(KeyEventArgs e, int rowIndex)

Handles a key pressed while the cell has the focus: with BinaryTreeListView.ExpandCollapsingOfNodesLevel set to ExpandCollapsingOfNodesLevel.TreeListViewCell, Shift+Right opens the node and Shift+Left closes it.

Parameters
e
The key that was pressed.
rowIndex
The row the cell is in.

OnLeave

protected override void OnLeave(int rowIndex, bool throughMouseClick)

Handles the focus leaving the cell, restoring the control's BinaryTreeListView.CellEditingMode.

Parameters
rowIndex
The row the cell is in.
throughMouseClick
true when the focus moved because of a click.

OnMouseDown

protected override void OnMouseDown(DataGridViewCellMouseEventArgs e)

Handles a mouse press on the cell: works out which part was pressed, raises BinaryTreeListView.BinaryTreeListViewCellClicked, and then, unless a handler cancelled it, opens or closes the node, changes its check box, or lets the press select the text.

Parameters
e
The data for the event.
Remarks

A press on the glyph, check box or image area never starts an edit, and ends one in progress when BinaryTreeListView.EnableCommitingEditWhenMovingFocusFromEditContext is on.

OnMouseUp

protected override void OnMouseUp(DataGridViewCellMouseEventArgs e)

Handles the mouse button being released over the cell, ending the control's handling of the click.

Parameters
e
The data for the event.

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 the cell: its text, then the node's image or check box, the connecting lines and the expand glyph.

Remarks

A cell whose value is null is not painted at all – give every node a value in the tree column.