Resizes the specified column to the minimum width required to display the column's contents completely.
public void BestFitColumn( BaseColumn column )
Public Sub BestFitColumn( column As BaseColumn )
A TreeListColumn that is the column whose width should be optimized.
The BestFitColumn method calculates the minimum width that is required to accommodate the content of the following elements: column header, summary footer cell, data cells. Areas, which are taken into account, are specified by the TreeListView.BestFitArea property.
Note that the number of processed data cells depends upon the TreeListView.BestFitMaxRowCount property value. If set to -1, all data cells are processed. If set to a positive integer, the property specifies the number of cells to be processed. Cells are processed starting from the top visible row.
When the auto width feature is applied to the view, column element contents may not be displayed completely after calling BestFitColumn. The reason is that total column width always matches the TreeList width - while columns have a minimum allowed width and may have a fixed width. Refer to the BaseColumn.MinWidth and BaseColumn.FixedWidth properties for details on column width restrictions.
Also note that the calculated column width cannot exceed the current TreeList width. Finally, the BestFitColumn method cannot resize columns to widths less than that specified by the BaseColumn.MinWidth property.
Your end-users can also apply best fit to columns. They need to double-click the desired column's right edge or choose the Best Fit item from the column header's context menu for this purpose. The column's BaseColumn.FixedWidth option must be disabled and the BaseColumn.AllowResizing option must be enabled to activate this functionality.
The BestFitColumn method should only be called when the treelist is loaded.
Refer to the Best Fit topic to learn more.