Here is an example:
void tableLayoutPanel_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
{
Graphics g = e.Graphics;
Rectangle r = e.CellBounds;
g.FillRectangle(GetBrushFor(e.Row, e.Column), r);
}
private Brush GetBrushFor(int row, int column)
{
if (row == 2 && column == 1)
return Brushes.Red;
// other logic
// ...
// return default Brush
}
Remark - it looks strange that you want to assign color based on just on row and column index, instead of some business logic (i.e. depending on data displayed in cell).