ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.DefColWidth Property

Gets or sets the default width for all grid columns.

[Visual Basic]

Public Property DefColWidth As Integer

[C#]

public int DefColWidth {get;set;}

[Delphi]

public property DefColWidth: Int32 read get_DefColWidth write set_DefColWidth;

Remarks

For bound grids, the DefColWidth property is respected under the following circumstances:

·      When the grid's layout is initialized at run time.

·      When a new column is created at run time.

If the DefColWidth property is set to 0, the grid automatically sizes all columns based on either the width of the column heading or the display width of the underlying field, whichever is larger. If the DefColWidth property is set to 0, the grid automatically sizes all columns based on either the width of the column heading or the display width of the underlying field, whichever is larger.

In bound mode, some data sources do not provide text field widths when requested by the grid. Therefore, if DefColWidth is 0, the actual column widths may not be as expected since the grid must supply a default width.

Example

The following code sets the default column width to the width of the first column:

·      Visual Basic

       Me.C1TrueDBGrid1.DefColWidth = Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).Width

·      C#

       this.c1TrueDBGrid1.DefColWidth = this.C1TrueDBGrid1.Splits[0].DisplayColumns[0].Width;

·      Delphi

       Self.C1TrueDBGrid1.DefColWidth := Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0].Width;

See Also

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


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