private void dataGridViewMain_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == 2)
{
e.CellStyle.SelectionForeColor = Color.Yellow;
e.CellStyle.SelectionBackColor = Color.Green;
e.CellStyle.ForeColor = Color.Red;
e.CellStyle.BackColor = Color.Blue;
}
}