ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1DisplayColumn.AutoSize Method

Adjusts the width of a column to accommodate the longest visible field within that column.

[Visual Basic]

Public Sub AutoSize()

[C#]

public void AutoSize()

[Delphi]

public procedure AutoSize();

Remarks

Calling this method in code has the same effect as the user double-clicking a column divider.

If the column is hidden or scrolled out of view, calling this method results in a trappable error.

The AllowSizing property must be set to True for columns to be resized by the user. However, the AutoSize method can be used when the column's AllowSizing property is False, just as the column width can be set when AllowSizing is False.

Example

The following code uses the AutoSize method to adjust the width of the Notes column to accommodate the longest visible field within the column:

·      Visual Basic

       Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Notes").AutoSize()

·      C#

       this.c1TrueDBGrid1.Splits[0].DisplayColumns["Notes"].AutoSize();

·      Delphi

       Self.C1TrueDBGrid1.Splits[0].DisplayColumns['Notes'].AutoSize;

See Also

C1DisplayColumn Class | C1DisplayColumn Members | C1.Win.C1TrueDBGrid Namespace


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.