现在Grid控件有三列,第三列显示的是考试的分数需要用进度条来显示长度就是设置该列的ColumnEdit为RepositoryItemProgressBar。但我现在需要设置分数小于60的该“进度条”为红色,及格的为绿色。代码如下:Page_Load List<Exam> lstEx = new List<Exam>(); lstEx.Add(new Exam("Janes", "Advanced Math", 82));
lstEx.Add(new Exam("Janes", "Black Literature", 53));
lstEx.Add(new Exam("Tony", "American History", 68));
lstEx.Add(new Exam("Jame", "Psychology", 12));
lstEx.Add(new Exam("Mary", "Advanced Math", 91));
lstEx.Add(new Exam("Mary", "Psychology", 43)); gridControl1.DataSource = lstEx; private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
//e.Column.
if (e.Column.Caption == "Socket")
{
int soc = Int32.Parse(e.CellValue.ToString());
DevExpress.XtraEditors.Repository.RepositoryItemProgressBar a = (DevExpress.XtraEditors.Repository.RepositoryItemProgressBar)e.Column.ColumnEdit; if(soc<=60)
a.StartColor=Color.Red;
else
a.StartColor=Color.Green;
}
}但显示结果却不对。
请问各位高手,这是怎么回事。
lstEx.Add(new Exam("Janes", "Black Literature", 53));
lstEx.Add(new Exam("Tony", "American History", 68));
lstEx.Add(new Exam("Jame", "Psychology", 12));
lstEx.Add(new Exam("Mary", "Advanced Math", 91));
lstEx.Add(new Exam("Mary", "Psychology", 43)); gridControl1.DataSource = lstEx; private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
//e.Column.
if (e.Column.Caption == "Socket")
{
int soc = Int32.Parse(e.CellValue.ToString());
DevExpress.XtraEditors.Repository.RepositoryItemProgressBar a = (DevExpress.XtraEditors.Repository.RepositoryItemProgressBar)e.Column.ColumnEdit; if(soc<=60)
a.StartColor=Color.Red;
else
a.StartColor=Color.Green;
}
}但显示结果却不对。
请问各位高手,这是怎么回事。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货