ComponentOne True DBGrid for WinForms
Data Presentation Techniques / Data-Sensitive Cell Merging / Formatting Merged Cells
In This Topic
    Formatting Merged Cells
    In This Topic

    Use the HorizontalAlignment and VerticalAlignment properties of the column's Style object to center the data within the merged cell, as in the following figure.


    In the Splits Collection Editor, access these properties by expanding the Style property node at the same level of the tree as the Merge property. Or, in code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    With Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Country").Style
        .HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Center
        .VerticalAlignment = C1.Win.C1TrueDBGrid.AlignVertEnum.Center
    End With
    

    To write code in C#

    C#
    Copy Code
    C1.Win.C1TrueDBGrid.Style s;
    s = this.c1TrueDBGrid1.Splits[0].DisplayColumns["Country"].Style;
    s.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Center;
    s.VerticalAlignment = C1.Win.C1TrueDBGrid.AlignVertEnum.Center;
    
    See Also