How to set the cell properties for a range of cells

10 Jun 20211 minute to read

Use the GridControl’s ChangeCells method by passing it a GridRangeInfo object to change the appearance of a range of cells.

To set the BackColor and TextColor for a range of cells, use the below given code snippet.

//Style settings.
GridStyleInfo style = new GridStyleInfo();
style.TextColor = Color.Red;
style.BackColor = Color.LightBlue;

//Modifies a range of cells.
gridControl1.ChangeCells(GridRangeInfo.Cells(1, 1, 4, 5), style);
'Style settings.
Dim style As New GridStyleInfo()
style.TextColor = Color.Red
style.BackColor = Color.LightBlue

' Modifies a range of cells.
GridControl1.ChangeCells(GridRangeInfo.Cells(1, 1, 4, 5), style)