我想在我的行Chckbox处于选定模式后更改datagridview中特定行的颜色:
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
bool isSelect = dataGridView1[0, e.RowIndex].Value as bool? ?? false;
if (isSelect)
{
// Change row color
}
}
答案 0 :(得分:2)
if (isSelect)
{
// Change row color
var row = this.dataGridView1.Rows[e.RowIndex]
row.DefaultCellStyle.BackColor = Color.Red;
}