ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Modifying a Style Property Directly

Customize the appearance of a grid component by modifying one or more members of an appropriate style property. For example, to make the grid's caption text bold, change the Font object associated with the CaptionStyle property. At design time, this is done by expanding the CaptionStyle tree node on the Properties window, expanding the Font node, and setting the Bold property to True. The change is committed to the grid when you click out of this particular property.

Note when switching to the C1TrueDBGrid Style Editor, it will be seen that the built-in Caption style has not changed.

This means that the following statements are not equivalent:

·      Visual Basic

Dim myfont As New Font(Me.C1TrueDBGrid1.Font, FontStyle.Bold)

Me.C1TrueDBGrid1.CaptionStyle.Font = myfont

 

Me.C1TrueDBGrid1.Styles("Caption").Font = myfont

·      C#

Font  myfont = new Font(this.C1TrueDBGrid1.Font, FontStyle.Bold);

this.C1TrueDBGrid1.CaptionStyle.Font = myfont;

 

this.C1TrueDBGrid1.Styles("Caption").Font = myfont;

·      Delphi

var myfont: Font;

 

myfont := Font.Create(Self.C1TrueDBGrid1.Font, FontStyle.Bold);

Self.C1TrueDBGrid1.CaptionStyle.Font := myfont;

Self.C1TrueDBGrid1.Styles['Caption'].Font := myfont;

The first statement specializes the font of the grid's caption bar; because this is a root style, the named Caption style also changed.


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