这样做的正确方法是什么
private void grid1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
for (int i = 0; i < grid1.Rows.Count; i++)
{
if (grid1.Rows[i].Cells[6].Value.Equals >= (740))
{
grid1.Rows[i].Cells[6].Style.BackColor = System.Drawing.Color.Red;
}
答案 0 :(得分:0)
您只需要查看Value
即可。 Equals()
是一种检查相等性的方法。
private void grid1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
for (int i = 0; i < grid1.Rows.Count; i++)
{
if (grid1.Rows[i].Cells[6].Value >= 740)
{
grid1.Rows[i].Cells[6].Style.BackColor = System.Drawing.Color.Red;
}