Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Column Resizing

Columns can be resized by the user without application program intervention. By dragging the separator between column headers, column footers or cells in the item area, users can adjust column widths to their particular needs. Column resizing is defined using the properties ColumnsClass.Resizable, HeadersClass.Resizable, FootersClass.Resizable, ColumnClass.Resizable.

Columns can be defined with a minimum and maximum column width (see the ColumnClass.MinWidth and ColumnClass.MaxWidth properties). The user is unable to make the column smaller or larger than the minimum and maximum widths defined. However, an application can still make the column smaller or larger using properties and methods such as ColumnClass.MakeOptimal or ColumnClass.Width, etc.

If the resizing area of a column header or column footer is double-clicked, the column is optimally resized. The SftTree.MaxScan property can be used to limit the number of items examined while calculating the optimal column width.

An application receives the ColumnResized event as the column sizes change.

The application can define certain columns as not resizable (see ColumnClass.Resizable). This could be useful for columns that contain a graphic which always has the same width. By using ColumnClass.MakeOptimal once to calculate the optimal width of the column, the column is wide enough to display all of its data, so there is no need to allow the user to resize it.

Non resizable columns are also useful to hide entire columns from a user, e.g., if a user does not have sufficient authorization to view some data, the application could still load all information into the control, yet hide selected columns by locking them and setting their width to 0. This simplifies program logic as the application can work with constant column numbers, yet the data is not shown to users with insufficient authority.