ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Example 10 - Setting the Alignment for Column Headers

This example illustrates the distinction between general and specific alignment for column headers and footers. If the HorizontalAlignment member of the HeadingStyle (or FooterStyle) property is not set to AlignHorzEnum.General, then the header (or footer) is aligned independently of the data cells.

The following code sets the alignment for column headers:

·      Visual Basic

With Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0)

    .HeadingStyle.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Near

    .FooterStyle.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Far

    .Style.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Center

End With

·      C#

C1TrueDBGrid1.Splits[0].DisplayColumns[0].HeadingStyle.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Near;

C1TrueDBGrid1.Splits[0].DisplayColumns[0].FooterStyle.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.Far;

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

·      Delphi

with Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0] do

begin

  HeadingStyle.HorizontalAlignment := C1.Win.C1TrueDBGrid.AlignHorzEnum.Near;

  FooterStyle.HorizontalAlignment := C1.Win.C1TrueDBGrid.AlignHorzEnum.Far;

  Style.HorizontalAlignment := C1.Win.C1TrueDBGrid.AlignHorzEnum.Center;

end;

 


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