当我尝试为约束值着色行时,由于字符串值如下所示:
private void gvTerbiyedekiDispolar_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
{
GridView View = sender as GridView;
if (e.RowHandle >= 0)
{
string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["fire"]);
if (category == "0,10")
{
e.Appearance.BackColor = Color.LightGoldenrodYellow;
}
}
}
但是如果我尝试“为大于 0.1 的值着色”,它会给我类似这段代码的运行时错误
private void gvTerbiyedekiDispolar_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
{
GridView View = sender as GridView;
if (e.RowHandle >= 0)
{
double category = Convert.ToDouble(View.GetRowCellDisplayText(e.RowHandle, View.Columns["fire"]));
if (category > 0.10)
{
e.Appearance.BackColor = Color.LightGoldenrodYellow;
}
}
}
我该怎么办 ?