ComponentOne True DBGrid Pro 8
DefColWidth Property

DefColWidth Property

This property returns or sets the default width for all grid columns in terms of the coordinate system of the grid's container.

Syntax

object.DefColWidth= single

Remarks

Read/Write at run time and design time.

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

·      When you execute the Retrieve Fields command at design time.

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

·      When a new column is created at run time.

For unbound grids, the DefColWidth property is only respected when a new column is created at run time.

If you set the DefColWidth property 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. For example, to set the default column width to the width of the first column:

TDBGrid1.DefColWidth = TDBGrid1.Columns(0).Width

Note

Setting the DefColWidth property at run time does not affect existing columns, only those that are subsequently created in code.

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 what you expect since the grid must supply a default width.

See Also

TDBGrid Control

TDBDropDown Control

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback