ComponentOne True DBGrid for WinForms
How to Use Styles / Built-In Named Styles / Modifying Named Styles
In This Topic
    Modifying Named Styles
    In This Topic

    Change the appearance of the overall grid at design time by using .NET’s collection editors to modify the GridStyleCollection. For example, to force all column headers to center their caption text, change the HorizontalAlignment property of the built-in Heading style to AlignHorzEnum.Center.

    The following statement accomplishes the same result in code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1TrueDBGrid1.Styles("Heading").HorizontalAlignment = AlignHorzEnum.Center
    

    To write code in C#

    C#
    Copy Code
    this.c1TrueDBGrid1.Styles["Heading"].HorizontalAlignment = AlignHorzEnum.Center;
    

    However, it is not necessary to use the C1TrueDBGrid Style Editor or manipulate named members of the GridStyleCollection in code, as the grid and its component objects expose several properties that return Style objects. As the next section describes, the appearance of the grid can be fine-tuned by manipulating these objects directly. For more information see Using the C1TrueDBGrid Style Editor.

    See Also