DataGridView changing cell background color

后端 未结 10 1686
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 10:20

I have the following code :

private void dgvStatus_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
    foreach (DataGridViewRow          


        
10条回答
  •  臣服心动
    2020-11-30 10:56

    int rowscount = dataGridView1.Rows.Count;         
    
    for (int i = 0; i < rowscount; i++)
    {            
        if (!(dataGridView1.Rows[i].Cells[8].Value == null))
        {
            dataGridView1.Rows[i].Cells[8].Style.BackColor = Color.LightGoldenrodYellow;
        }
    }
    

提交回复
热议问题