SftTree/OCX 7.0

SftTreeColumn.OptimalWidthPix Property

Softel vdm, Inc.

Returns the column's optimal width based on its contents.

Syntax       

Get

VB.NET

WPix = object.OptimalWidthPix  As Integer

VB

WPix = object.OptimalWidthPix  As Long

C#.NET

int WPix = object.OptimalWidthPix;

VC++

long WPix = object->OptimalWidthPix;
long WPix = object->GetOptimalWidthPix();

C

HRESULT object->get_OptimalWidthPix(long* WPix);

Delphi

WPix := object.OptimalWidthPix   : Integer;

object

A SftTreeColumn object.

WPix

Returns the column's optimal width based on its contents.

Comments

The OptimalWidthPix property returns the column's optimal width based on its contents.

The Column.OptimalWidth and Column.OptimalWidthPix properties are synonyms, but may use different coordinate systems.

This property calculates the optimal width of the 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.

Column.OptimalWidth 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  SftTreeColumn Object | Object Hierarchy


Feedback / comments / error reports for this topic
© 2015 - Softel vdm, Inc. - www.softelvdm.com