Fataj CellFormatting event datagridview-a.
Code:
private void testDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
DataGridView dgv = (DataGridView)sender;
DataGridViewRow dgvr = dgv.Rows[e.RowIndex];
try
{
if (bool.Parse(dgvr.Cells["dataGridViewTextBoxColumn1"].Value.ToString()) == true)
{
e.CellStyle.BackColor = Color.LightBlue;
}
else if (double.Parse(dgvr.Cells["dataGridViewTextBoxColumn7"].Value.ToString()) < 1)
{
e.CellStyle.BackColor = Color.LightPink;
}
}
catch { }
}