【发布时间】:2015-01-11 18:11:30
【问题描述】:
我有一个包含数据网格的 windows 窗体。 目前我有事件“dataGrid_CellFormatting”,它检查单元格的内容是否包含单词 FAIL 并将该单元格的颜色更改为红色。这行得通。 我需要更改什么才能将整个行更改为红色并且只有单元格?
谢谢
private void dataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (dataGrid.Columns[e.ColumnIndex].Name.Equals("cResult"))
{
if ((String)e.Value == "FAIL")
{
e.CellStyle.BackColor = Color.Red;
}
}
}
【问题讨论】: