我试图让数据网格根据项目的数量显示不同的颜色行。
我遇到的问题是 if 语句:
if (RowType == < 5)
无效,如何解析要根据值检查的行类型?
foreach (DataGridViewRow row in dtaPart.Rows)
{
//Cell three is where quantity is
string RowType = row.Cells[3].Value.ToString();
if (RowType == //> 5)
{
row.DefaultCellStyle.BackColor = Color.White;
row.DefaultCellStyle.ForeColor = Color.Black;
}
else if (RowType == //< 5)
{
row.DefaultCellStyle.BackColor = Color.Orange;
row.DefaultCellStyle.ForeColor = Color.Black;
}
else if (RowType == //< 1)
{
row.DefaultCellStyle.BackColor = Color.Red;
row.DefaultCellStyle.ForeColor = Color.Black;
}
}