| True DBGrid for WinForms Task-Based Help > Setting the Grid's Appearance > Aligning the Column Headers |
You may choose to align the column headers with or without aligning the column text. In the following example, the caption for the Last column has been centered:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Last").HeadingStyle.HorizontalAlignment = AlignHorzEnum.Center
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1TrueDBGrid1.Splits[0].DisplayColumns["Last"].HeadingStyle.HorizontalAlignment = AlignHorzEnum.Center; |
|
The First column is has been center-aligned:
To align all column headers in the grid, loop through each column.