ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Example 3 - Affecting All Elements Only in the First Split

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

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

·      Visual Basic

Dim myfont As Font

Dim myfont1 As Font

Dim myfont2 As Font

Dim myfont3 As Font

 

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

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

 

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

Me.C1TrueDBGrid1.Splits(0).CaptionStyle.Font = myfont1

 

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

Me.C1TrueDBGrid1.Splits(0).HeadingStyle.Font = myfont2

 

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

Me.C1TrueDBGrid1.Splits(0).FooterStyle.Font = myfont3

·      C#

Font myfont;

Font myfont1;

Font myfont2;

Font myfont3;

 

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

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

 

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

this.C1TrueDBGrid1.Splits[0].CaptionStyle.Font = myfont1;

 

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

this.C1TrueDBGrid1.Splits[0].HeadingStyle.Font = myfont2;

 

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

this.C1TrueDBGrid1.Splits[0].FooterStyle.Font = myfont3;

·      Delphi

var myfont: Font;

    myfont1: Font;

    myfont2: Font;

    myfont3: Font;

 

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

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

 

myfont1 := Font.Create(Self.C1TrueDBGrid1.Splits(0).CaptionStyle.Font, FontStyle.Bold);

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

 

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

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

 

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

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

 


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