其他分享
首页 > 其他分享> > 设置DataGridView的单元格颜色

设置DataGridView的单元格颜色

作者:互联网

RowPrePaint事件:

private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)

{
if ("不存在" == this.dataGridView1.Rows[e.RowIndex].Cells["库位"].Value.ToString())
{
this.dataGridView1.Rows[e.RowIndex].Cells["库位"].Style.BackColor = Color.MediumPurple;
}
}

标签:RowPrePaint,Rows,颜色,RowIndex,Cells,单元格,DataGridView,dataGridView1,库位
来源: https://www.cnblogs.com/roak/p/14148013.html