ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Example 9 - Setting the Alignment of C1DisplayColumn Objects

Setting the HorizontalAlignment property of a C1DisplayColumn object affects not only its data cells, but also its header and footer. The reason for this is that the default setting of the HorizontalAlignment property for the built-in Heading and Footing styles, which is inherited from the Normal style, is set to AlignHorzEnum.General. For data cells, the general setting means that the underlying data type determines whether the cell text is left, center, or right aligned; for column headers and footers, the general setting means that the column's data cell alignment should be followed.

The following code sets the alignment of C1DisplayColumn objects:

·      Visual Basic

Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).Style.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Center

·      C#

this.C1TrueDBGrid1.Splits[0].DisplayColumns[0].Style.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Center;

·      Delphi

Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0].Style.HorizontalAlignment := C1.Win.C1TrueDBGrid.AlignHorzEnum.Center;

 


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