c#更改dataGridView中单元格的背景颜色(如果其值更改)
您好,我想更改datagridview中单元格的背景颜色(如果其值更改) 我写过这样的onChange事件:c#更改dataGridView中单元格的背景颜色(如果其值更改),c#,datagrid,onchange,C#,Datagrid,Onchange,您好,我想更改datagridview中单元格的背景颜色(如果其值更改) 我写过这样的onChange事件: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name == "Version") { //Change
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "Version")
{
//Change Background
}
}
那么,现在如何更改已更改单元格的值呢?DataGridViewCellEventArgs参数包含此处所需的全部内容
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "Version")
{
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.AliceBlue;
}
}
DataGridViewCellEventArgs参数包含此处所需的全部内容
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "Version")
{
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.AliceBlue;
}
}
DataGridViewCellEventArgs参数包含此处所需的全部内容
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "Version")
{
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.AliceBlue;
}
}
DataGridViewCellEventArgs参数包含此处所需的全部内容
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "Version")
{
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.AliceBlue;
}
}