关于一个ultraGrid单元格染色的问题

scan_sky6 2010-08-09 01:29:53
private void doQuery(string strWhere)
{
label1.Focus();
try
{
string strError = "";
DataSet ds = (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("CXGL", "Core.SGLims.QryDataManage.QryManageLogic",
"GetAnaData", new object[] { strWhere }, out strError);
if (strError != "")
{
MessageBox.Show(strError, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
this.dataTable2.Clear();
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow Drow in ds.Tables[0].Rows)
{
DataRow newRow = dataTable2.NewRow();
foreach (DataColumn dataColumn in dataTable2.Columns)
{
if (dataColumn.ColumnName.ToUpper() == "CHECKUPFLAG")
{
newRow[dataColumn.ColumnName] = Drow[dataColumn.ColumnName].ToString() == "0" ? "未审核" : Drow[dataColumn.ColumnName].ToString() == "1" ? "合格"
: Drow[dataColumn.ColumnName].ToString() == "2" ? "不合格" : Drow[dataColumn.ColumnName].ToString() == "3" ? "异常" : "";
continue;
}
if (dataColumn.ColumnName.ToUpper() == "CHECKADDRESS")
{
newRow[dataColumn.ColumnName] = Drow[dataColumn.ColumnName].ToString() == "1" ? "炉前化验室" : Drow[dataColumn.ColumnName].ToString() == "2" ? "中心化验室"
: "";
continue;
}
newRow[dataColumn.ColumnName] = Drow[dataColumn.ColumnName].ToString();
}
dataTable2.Rows.Add(newRow);
}

dataTable2.AcceptChanges();
ultraGrid2.DataSource = this.dataSet2;
Constant.RefreshAndAutoSize(ultraGrid2);
MarkColor(ultraGrid2);

}
}
}
catch (System.Exception exp)
{
MessageBox.Show(exp.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void MarkColor(UltraGrid uGrid)
{
for (int i = 0; i < uGrid.Rows.Count; i++)
{
string strCheckVal = uGrid.Rows[i].Cells["AUDITRESULT"].Value.ToString().Trim();
string strInctrlVal = uGrid.Rows[i].Cells["INCTRLRESULT"].Value.ToString().Trim();
if (strCheckVal != "")
{
string[] results = strCheckVal.Split(';');
foreach (string result in results)
{
string[] sresult = result.Split(':');
if (result.IndexOf("表达式") >= 0)
{
continue;
}
if (result.IndexOf("高") >= 0 || result.IndexOf("低") >= 0)
{
uGrid.Rows[i].Cells["ANA_" + sresult[0].ToUpper()].Appearance.ForeColor = Color.Red;
}
}
}
if (strInctrlVal != "")
{
string[] ctrlResults = strInctrlVal.Split(';');
foreach (string ctrlresult in ctrlResults)
{
string[] cresult = ctrlresult.Split(':');
if (ctrlresult.IndexOf("表达式") >= 0)
{
continue;
}
if (uGrid.Rows[i].Cells["ANA_" + cresult[0].ToUpper()].Appearance.ForeColor != Color.Red && (ctrlresult.IndexOf("高") >= 0 || ctrlresult.IndexOf("低") >= 0))
{
uGrid.Rows[i].Cells["ANA_" + cresult[0].ToUpper()].Appearance.ForeColor = Color.Blue;
}
}
}
}
uGrid.Refresh();
}
采用C/S+oracle的三层结构的分布式系统,上面是客户端查询代码,
ultraGrid与dataSet静态绑定,以上代码请求服务端返回查询结果,并将utraGrid不合格单元格染上颜色;
现在共有若干个客户端,只有其中一个客户端机器上的客户端程序不正常,当第一次查询出有不合元素染色正常,接下来的查询不能刷新前面染色的单元格,不管是合格还是不合格,都会保留原来因不合格而染上的蓝色或红色。
该客户端安装的是Windowsxp+sp3操作系统,该操作系统的.net2.0框架后来安装的,程序运行查询,新增都正常,唯独染色ultraGrid单元格出现怪异现象,而在其它装有同样程序的客户端却是染色更新正常的。为了保证此电脑上客户与其它客户端一致,我从其它客户端将程序完整拷贝到该电脑上,结果还是一样。
百思不得其解,望大侠们帮忙。
...全文
202 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
scan_sky6 2010-08-10
  • 打赏
  • 举报
回复
up一下,希望有懂的大侠来看看.
JiuchunYoung 2010-08-09
  • 打赏
  • 举报
回复
帮你顶顶 期待 有人过来瞧瞧 看看 呵呵
  • 打赏
  • 举报
回复
哎,这么多代码
loveheye 2010-08-09
  • 打赏
  • 举报
回复
帮你UP 防止下沉
scan_sky6 2010-08-09
  • 打赏
  • 举报
回复
自己 up一下,不要下沉

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧