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;
            }
        }
原文地址:https://www.cnblogs.com/wjhx/p/1792456.html