Each cell within the VIBlend WinForms DataGridView control can have its own style. A cell style can modify properties like text format, background color, foreground color, border color, and font. In most cases multiple cells will share particular style characteristics. To customize a cell style, start by creating a new instance of the GridCellStyle class.
GridCellStyle cellStyle = new GridCellStyle();
The next step is to set the appropriate values for each Style propoperty:
FillStyle cellFillStyle = new FillStyleGradientEx(Color.Aqua, Color.Aqua, Color.Aqua, Color.Aqua,
90, 0.7f, 0.7f);
cellStyle.TextColor = Color.Black;
cellStyle.TextColorSelected = Color.Black;
cellStyle.Font = this.Font;
cellStyle.FillStyle = cellFillStyle;
cellStyle.FillStyleSelected = cellFillStyle;
cellStyle.BorderColorSelected = Color.Transparent;
cellStyle.BorderColor = Color.Transparent;
Finally, apply the style to one or more grid cells:
HierarchyItem rowItem = this.Grid1.RowsHierarchy.Items[1];
HierarchyItem colItem = this.Grid1.ColumnsHierarchy.Items[1];
this.Grid1.CellsArea.SetCellDrawStyle(rowItem, colItem, cellStyle);
You can also apply a cell style to all grid cells in any row:
HierarchyItem rowItem = this.Grid1.RowsHierarchy.Items[1];
rowItem.CellsStyle = cellStyle;
Similarily, you can apply a cell style to all grid cells in any column:
HierarchyItem colItem = this.Grid1.ColumnsHierarchy.Items[1];
colItem.CellsStyle = cellStyle;