SftTree/NET 2.0 Documentation


Width Property, ColumnClass Class

Defines the column's width, adjusting for open-ended columns.

Class: ColumnClass
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET


public int Width { get; set; }
Public Property Width As Integer


The width in pixels.

The default value is 100.


Defines the column's width, adjusting for open-ended columns.

The Width property determines the width of the column, including any additional space allocated to an open-ended last column (see ColumnsClass.LastOpenended). When an open-ended last column is used, the width of the space available to the column can be larger. An open-ended column will always use the space remaining between the previous column and the right edge of the tree control window.

The ColumnsClass._Width property returns the last width assigned to the Width property.

When updating a column's width, the SftTree.HorizontalExtent (and SftTree.HorizontalExtentRight) property is automatically updated to match the new width.

Due to the variable number of levels and the resulting hierarchical display, the width of the first column is always treated as a minimum width. The cells in the hierarchy column will always be at least of the specified width, no matter what level the item is on. This can result in the first column being much wider than the defined width. To calculate the actual width of hierarchy column, add the value returned by the SftTree.OverheadWidth property to the value returned by hierarchy column's ColumnClass.Width property.

The ColumnClass.GetOptimalWidth or ColumnClass.MakeOptimal methods can be used to calculate or define the optimal width for a column. An optimal width allows all cell contents in a column to be displayed in their entirety, without being clipped.

See Also ColumnClass Class | Classes | SftTree/NET 2.0