ComponentOne True DBGrid for WinForms
Customizing the Grid's Appearance / Row Height and Word Wrap / Adjusting the Height of All Grid Rows
In This Topic
    Adjusting the Height of All Grid Rows
    In This Topic

    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:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1TrueDBGrid1.RowHeight = 0
    Me.C1TrueDBGrid1.RowHeight = 3 * Me.C1TrueDBGrid1.RowHeight
    

    To write code in C#

    C#
    Copy Code
    this.c1TrueDBGrid1.RowHeight = 0;
    this.c1TrueDBGrid1.RowHeight = 3 * this.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.

    See Also