ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Example 5 - Affecting All Elements Only in the First Column of the First Split

This example extends the previous one to render all elements of the first column of the first split in bold. In addition to the Style property, it is necessary to set the HeadingStyle and FooterStyle properties.

The following code affects all elements only in the first column of the first split:

·      Visual Basic

Dim myfont As Font

Dim myfont1 As Font

Dim myfont2 As Font

 

myfont = New Font (Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).Style.Font, FontStyle.Bold)

Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).Style.Font = myfont

 

myfont1 = New Font (Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).HeadingStyle.Font, FontStyle.Bold)

Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).HeadingStyle.Font = myfont1

 

myfont2 = New Font (Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).FooterStyle.Font, FontStyle.Bold)

Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).FooterStyle.Font = myfont2

·      C#

Font myfont;

Font myfont1;

Font myfont2;

 

myfont = new Font (this.C1TrueDBGrid1.Splits[0].DisplayColumns[0].Style.Font, FontStyle.Bold);

this.C1TrueDBGrid1.Splits[0].DisplayColumns[0].Style.Font = myfont;

 

myfont1 = new Font (this.C1TrueDBGrid1.Splits[0].DisplayColumns[0].HeadingStyle.Font, FontStyle.Bold);

this.C1TrueDBGrid1.Splits[0].DisplayColumns[0].HeadingStyle.Font = myfont1;

 

myfont2 = new Font (this.C1TrueDBGrid1.Splits[0].DisplayColumns[0].FooterStyle.Font, FontStyle.Bold);

this.C1TrueDBGrid1.Splits[0].DisplayColumns[0].FooterStyle.Font = myfont2;

·      Delphi

var myfont: Font;

    myfont1: Font;

    myfont2: Font;

 

myfont := Font.Create(Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0].Style.Font, FontStyle.Bold);

Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0].Style.Font := myfont;

 

myfont1 := Font.Create(Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0].HeadingStyle.Font, FontStyle.Bold);

Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0].HeadingStyle.Font := myfont1;

 

myfont2 := Font.Create(Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0].FooterStyle.Font, FontStyle.Bold);

Self.C1TrueDBGrid1.Splits[0].DisplayColumns[0].FooterStyle.Font := myfont2;

 


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