The font style of a column can be set either in the designer or in code.
In the Designer
To set the font style using the C1TrueDBGrid Tasks menu:
1. Select the Country column in the grid and click it to open the C1TrueDBGrid Tasks menu.
2. Select Column Style from the menu.
3. Click the ellipsis button after the Font property to open the Font dialog box.
4. Set the Font to Times New Roman, the Font style to Bold, and click OK to close the Font dialog box.
5. Click OK to close the Column Style(Country) dialog box.
Alternatively, the font style can also be set through the TrueDBGrid Designer. To set the font style using the designer:
1. Open the TrueDBGrid Designer. For information on how to access the TrueDBGrid Designer, see Accessing the TrueDBGrid Designer.
2. Select the Country column by selecting it from the right pane.
The column can also be selected by choosing Country from the drop-down list on the toolbar.
3. Set the font to Times New Roman and click Bold on the toolbar.
4. Click OK to close the designer.
In Code
1. Declare a new font variable:
Dim fntFont As Font
· C#
Font fntFont;
· Delphi
Var fntFont: Font;
2. Set the desired column's font to the new font variable:
fntFont = New Font("Times New Roman", Me.C1TrueDBGrid1.Splits(0).DisplayColumns.Item("Country").Style.Font.Size, FontStyle.Bold)
Me.C1TrueDBGrid1.Splits(0).DisplayColumns.Item("Country").Style.Font = fntFont
· C#
fntFont = new Font("Times New Roman", this.c1TrueDBGrid1.Splits[0].DisplayColumns["Country"].Style.Font.Size, FontStyle.Bold);
this.c1TrueDBGrid1.Splits[0].DisplayColumns["Country"].Style.Font = fntFont;
· Delphi
fntFont := Font.Create(‘Times New Roman’, Self.C1TrueDBGrid1.Splits[0].DisplayColumns[‘Country’].Style.Font.Size, FontStyle.Bold);
Self.C1TrueDBGrid1.Splits[0].DisplayColumns[‘Country’].Style.Font := fntFont;
This topic illustrates the following:
In this example, the rows of the Country column are now Times New Roman font and bold.
For more information on specifying cell styles, see Applying Styles to Cells.
Send comments about this topic to ComponentOne. Copyright © ComponentOne LLC. All rights reserved. |