ComponentOne True DBGrid for WinForms
Multiple-Line Headers and Footers
Customizing the Grid's Appearance > Captions, Headers, and Footers > Multiple-Line Headers and Footers

The split specific property ColumnCaptionHeight property controls the height of the column headers. By default, it is based upon the font setting of the HeadingStyle. To display more than one line of text in a column header, increase the ColumnCaptionHeight property to accommodate additional lines, as in the following example:

To write code in Visual Basic

Visual Basic
Copy Code
With Me.C1TrueDBGrid1
    .Splits(0).ColumnCaptionHeight = .Splits(0).ColumnCaptionHeight * 2
    .Columns(0).Caption = "First line" + vbCrLf + "Second line"
End With

To write code in C#

C#
Copy Code
this.c1TrueDBGrid1.Splits[0].ColumnCaptionHeight = this.c1TrueDBGrid1.Splits[0].ColumnCaptionHeight * 2;
this.c1TrueDBGrid1.Columns[0].Caption = "First line\nSecond line";

Note the use of the "\n" to specify a line break within the caption text. After this code executes, the first column's caption will contain two lines of text, and the second column's caption will be centered vertically.


Similarly, set the ColumnFooterHeight property to control the height of column footers, and use the constant to specify a line break when setting the FooterText property of a column.

See Also