While setting a CellStyle on an entire column is straightforward, you may often need to highlight a specific, individual cell—for example, to mark an error or emphasize a single data point. You need a way to apply formatting like background colors to a specific row and column intersection without affecting the rest of the grid.
Solution
To style an individual cell, use the SetCellStyle method provided by the C1FlexGrid. First, you must define a new CellStyle object and add it to the grid’s Styles collection. Within this style, you can configure properties such as BackColor, ForeColor, or Font.
Once the style is defined, call SetCellStyle(row, col, style) by passing the specific row and column indices of the cell you wish to modify. This approach is more efficient than handling manual drawing events when you simply need to apply persistent formatting to specific coordinates in the grid.
CellStyle cs = _flex.Styles.Add("red");
Style.BackColor = Color.Red;
_flex.SetCellStyle(1,1,cs);