ComponentOne List for WinForms
In This Topic
    Example 9 - Setting the Alignment Property of C1DisplayColumn Objects
    In This Topic

    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 Normal, is set to 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:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1List1.Splits(0).DisplayColumns(0).Style.HorizontalAlignment = C1.Win.C1List.AlignHorzEnum.Center
    

    To write code in C#

    C#
    Copy Code
    this.c1List1.Splits[0].DisplayColumns[0].Style.HorizontalAlignment = C1.Win.C1List.AlignHorzEnum.Center;