SftTree/OCX 7.5 - ActiveX Tree Control


OptimalWidthPix Property, SftTreeRowHeaders Object

Returns the row header area's optimal width based on its contents.



VB.NETWPix = object.OptimalWidthPix As Integer
VBWPix = object.OptimalWidthPix As Long
C#.NETint WPix = object.OptimalWidthPix;
VC++long WPix = object->OptimalWidthPix;
long WPix = object->GetOptimalWidthPix();
CHRESULT object->get_OptimalWidthPix(long* WPix);


A SftTreeRowHeaders object.


Returns the row header area's optimal width in pixels based on its content.


The OptimalWidthPix property returns the row header area's optimal width based on its contents.

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

This method calculates the optimal width of the row header area so that the row/column header's text and graphic and the row header text and graphics can be completely displayed without being truncated or clipped. The row header width can be changed using the RowHeaders.Width property. The RowHeaders.MakeOptimal method can be used to set the optimal row header width without having to calculate it first.

By changing tree control properties, the optimal row header width may change. Adding items, setting new row header graphics and changing row header text are a few of the actions that can affect the optimal row header width. The row header width may have to be set again to allow items to be completely visible. The tree control does not automatically adjust the row header width.

Calculating the optimal row header width can be a time consuming operation, particularly if many items have been added to the tree control. 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 SftTreeRowHeaders Object | Object Hierarchy

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.