| FlexGrid for WinForms Task-Based Help > Setting the Font of a Single Cell |
To set the font of a single cell, create a new style and assign it to a cell.
In the Designer
In Code
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Dim cs As C1.Win.C1FlexGrid.CellStyle
cs = Me.C1FlexGrid1.Styles.Add("myStyle")
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
C1.Win.C1FlexGrid.CellStyle cs = this.c1FlexGrid1.Styles.Add("myStyle");
|
|
In the Designer
In Code
Add the following code to the Form_Load event:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
cs.Font = New Font("Tahoma", 10, FontStyle.Bold)
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
cs.Font = new Font("Tahoma", 10, FontStyle.Bold);
|
|
In the Designer
In Code
Add the following code to the Form_Load event:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
cs.ForeColor = Color.Blue |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
cs.ForeColor = Color.Blue; |
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.C1FlexGrid1.SetCellStyle(6, 2, "myStyle") |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1FlexGrid1.SetCellStyle(6, 2, "myStyle"); |
|
Carbon appears in Blue, Bold, 10 pt, Tahoma font.