To set the background color of columns and rows, create a new style and assign it to a column and row.
In the Designer
In Code
Add the following code to the Form_Load event:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim cc As C1.Win.C1FlexGrid.CellStyle cc = Me.C1FlexGrid1.Styles.Add("ColumnColor") |
To write code in C#
C# |
Copy Code
|
---|---|
C1.Win.C1FlexGrid.CellStyle cc = this.c1FlexGrid1.Styles.Add("ColumnColor"); |
In the Designer
In Code
Add the following code to the Form_Load event:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
cc.BackColor = Color.Cornsilk |
To write code in C#
C# |
Copy Code
|
---|---|
cc.BackColor = Color.Cornsilk; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1FlexGrid1.Cols(2).Style = Me.C1FlexGrid1.Styles("ColumnColor") |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1FlexGrid1.Cols[2].Style = this.c1FlexGrid1.Styles["ColumnColor"]; |
The background color of the Element column is set to CornSilk.
In the Designer
In Code
Add the following code to the Form_Load event:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim rs As C1.Win.C1FlexGrid.CellStyle rs = Me.C1FlexGrid1.Styles.Add("RowColor") |
To write code in C#
C# |
Copy Code
|
---|---|
C1.Win.C1FlexGrid.CellStyle rs = this.c1FlexGrid1.Styles.Add("RowColor"); |
In the Designer
In Code
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
rs.BackColor = Color.PowderBlue |
To write code in C#
C# |
Copy Code
|
---|---|
rs.BackColor = Color.PowderBlue; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1FlexGrid1.Rows(8).Style = Me.C1FlexGrid1.Styles("RowColor") |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1FlexGrid1.Rows[8].Style = this.c1FlexGrid1.Styles["RowColor"]; |
The background color of the row is set to PowderBlue. Notice how the column color takes precedence over the row color.