ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Adjusting the Height of All Grid Rows

Configure the row height interactively at design time by placing the grid in its visual editing mode or by changing the grid's RowHeight property in the Properties window. At run time, the user can adjust the row height interactively if AllowRowSizing is set to RowSizingEnum.AllRows or RowSizingEnum.IndividualRows. For more information, see Run-Time Interaction.

The RowHeight property is expressed as pixels. However, a setting of 0 causes the grid to readjust its display so that each row occupies a single line of text in the current font. Therefore, use the following code to adjust the row height to display exactly three lines of text:

·      Visual Basic

Me.C1TrueDBGrid1.RowHeight = 0

Me.C1TrueDBGrid1.RowHeight = 3 * Me.C1TrueDBGrid1.RowHeight

·      C#

this.C1trueDBGrid1.RowHeight = 0;

this.C1trueDBGrid1.RowHeight = 3 * this.C1trueDBGrid1.RowHeight;

·      Delphi

Self.C1TrueDBGrid1.RowHeight := 0;

Self.C1TrueDBGrid1.RowHeight := 3 * Me.C1TrueDBGrid1.RowHeight;

This technique is particularly effective when displaying multiple-line memo fields, as in this example.

Note that the Description column’s Style object must have its WrapText property set to True; otherwise, the memo field display will be truncated after the first line.


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