SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Calculates a column's optimal width based on the column contents.
Deprecated - Provided for compatibility with earlier versions only - Use Column.OptimalWidth instead
VB.NET | Width = object.CalcOptimalColumnWidth(ByVal ColIndex As Short) As Single |
VB | Width = object.CalcOptimalColumnWidth(ByVal ColIndex As Integer) As Single |
C#.NET | float Width = object.CalcOptimalColumnWidth(short ColIndex); |
VC++ | float Width = object->CalcOptimalColumnWidth(short ColIndex); |
C | HRESULT object->raw_CalcOptimalColumnWidth(short ColIndex, float* Width); |
object
ColIndex
The zero-based column number.
Width
Returns the optimal column width. The units used depend on the container (Visual Basic, Visual C++, etc.) and the coordinate system used.
Deprecated - Provided for compatibility with earlier versions only - Use Column.OptimalWidth instead
The CalcOptimalColumnWidth method calculates a column's optimal width based on the column contents.
This method calculates the optimal width of a specified column so that the column header's and each cell's text and graphic can be completely displayed without being truncated or clipped. The column width can be changed using the Column.Width property. The Column.MakeOptimal method can be used to set a column's optimal width without having to calculate it first.
By changing tree control properties, the optimal column width may change. Adding items, setting new cell graphics and changing cell text are a few of the actions that can affect the optimal column width. The column width may have to be set again to allow items to be completely visible.
The tree control does not automatically adjust column widths.
Cells which merge into an adjacent column are not considered when calculating the optimal column width.
Calculating the optimal column width can be a time consuming operation, particularly if many items have been added to the tree control.
CalcOptimalColumnWidth scans all items to determine the best column width, but can be limited to a specific number of items using the Items.CalcLimit property. This reduces the time spent to calculate the optimal width, but may still leave some items clipped.
If items are not visible because their parent items are collapsed, these can be excluded from the optimal width calculation by setting the Items.CalcVisibleOnly property to True.
See Also SftTree Object | Object Hierarchy