DataGridView中根据条件改变行的底色
private void dataGridViewX1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (iii == 1) { if ((bool)dataGridViewX1.CurrentRow.Cells[0].Value) dataGridViewX1.CurrentRow.DefaultCellStyle.BackColor = Color.Red; else dataGridViewX1.CurrentRow.DefaultCellStyle.BackColor = Color.Green; } }