我目前正在这样做:
private void dgResults_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
// Would be nice if we could do this on databind of each row instead and avoid looping
for (int r = 0; r < dgResults.Rows.Count; r++)
{
if (dgResults.Rows[r].Cells[5].Value.ToString() == "0")
{
for (int c = 0; c < dgResults.Rows[r].Cells.Count; c++)
{
dgResults.Rows[r].Cells[c].Style.ForeColor = Color.White;
}
}
}
}
但由于某种原因,它总是错过第一行。有一个更好的方法吗?