Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxColumn.CalcOptimalWidthPix Method

Returns the column's optimal width in pixels.

Syntax

VB.NETWidthPix = object.CalcOptimalWidthPix(ByVal MaxScan As Integer) As Integer
VBWidthPix = object.CalcOptimalWidthPix(ByVal MaxScan As Long) As Long
C#.NETint WidthPix = object.CalcOptimalWidthPix(int MaxScan);
VC++long WidthPix = object->CalcOptimalWidthPix(long MaxScan);
CHRESULT object->raw_CalcOptimalWidthPix(long MaxScan, long* WidthPix);

object

A SftBoxColumn object.

MaxScan

The maximum number of items analyzed to determine the optimal column width for the column described by object. If 0 is specified, all items will be considered.

WidthPix

Returns the column's optimal width in pixels.

Comments

The CalcOptimalWidthPix method returns the column's optimal width in pixels.

The Column.CalcOptimalWidth and CalcOptimalWidthPix methods are synonyms, but may use different coordinate systems.

This method calculates the optimal width of the column described by object 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 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 control does not automatically adjust column widths.

If items are not visible because their parent items are collapsed, these are always excluded from the optimal width calculation.

The combo box control does not automatically adjust column widths.

Calculating the optimal column width can be a time consuming operation, particularly if many items have been added to the control. CalcOptimalWidthPix scans all items to determine the best column width, but can be limited to a specific number of items using the MaxScan argument. This reduces the time spent to calculate the optimal width, but may still leave some items clipped.

See Also SftBoxColumn Object | Object Hierarchy


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