DataGridView中根据条件改变行的底色

1
2
3
4
5
6
7
8
9
10
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   龙少爷  阅读(326)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示