Skip to main content

TcxGridBand.ApplyBestFit(Boolean,Boolean) Method

Adjusts the width of the band in order to display its full content.

Declaration

procedure ApplyBestFit(ACheckSizingAbility: Boolean = False; AFireEvents: Boolean = False); virtual;

Parameters

Name Type
ACheckSizingAbility Boolean
AFireEvents Boolean

Remarks

Use the ApplyBestFit method to adjust the width of the band in order to display its columns’ cell contents entirely. The ACheckSizingAbility parameter specifies whether it’s necessary to check if the current band can be resized prior to adjusting its width. Set the ACheckSizingAbility parameter to True to specify that the width of the current band can only be adjusted if resizing is permitted, i.e. no restrictive options are set. Otherwise, the current band’s width can always be adjusted.

Set the AFireEvents parameter to True to specify that the events providing notifications about changes to the widths of the current band’s columns (such as the OnColumnSizeChanged event) should be fired.

The ApplyBestFit method iterates through data records and calculates the maximum width of column cells. It also takes the width of the column caption (see the Caption property) into account. By default, all data records are processed in order to calculate the best width. However, you can limit the number of records to process and thus improve performance via the BestFitMaxRecordCount property.

It is possible to adjust a band’s width by double-clicking its right edge. You can prevent an end-user from changing the band width either by setting the band’s Options.Sizing or the View’s OptionsCustomize.BandSizing properties to False.

See Also