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;
            }
        }

posted on 2010-08-04 17:18  龙少爷  阅读(326)  评论(0编辑  收藏  举报

导航