private void gvSendConfirm_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
string sCurrTime=DbHelperSql.GetSingle("Select GetDate() DateNow").ToString();
DateTime dtCurrTime,dtSendTime;
int iMinutes = ;
try
{
dtCurrTime=DateTime.Parse(sCurrTime);
}
catch (System.Exception ex)
{
dtCurrTime=DateTime.Now;
} string sSendTime= gvSendConfirm.GetDataRow(e.RowHandle)["UpdateTime"].ToString();
try
{
dtSendTime = DateTime.Parse(sSendTime);
}
catch (System.Exception ex)
{
dtSendTime = DateTime.Now;
} //计算时间差。
System.TimeSpan difTime = dtCurrTime.Subtract(dtSendTime);
iMinutes = difTime.Minutes; if (iMinutes <= iTimeOutLevel1)
{
e.Appearance.BackColor = Color.White; //设置背景色
}
else if (iMinutes > iTimeOutLevel1 && iMinutes <= iTimeOutLevel2)
{
e.Appearance.BackColor = Color.FromArgb(, , );//设置背景色
}
else if (iMinutes > iTimeOutLevel2 && iMinutes <= iTimeOutLevel3)
{
e.Appearance.BackColor = Color.FromArgb(, , );//设置背景色
}
else if (iMinutes > iTimeOutLevel3 && iMinutes <= iTimeOutLevel4)
{
e.Appearance.BackColor = Color.FromArgb(, , );//设置背景色
}
else if (iMinutes > iTimeOutLevel4 && iMinutes <= iTimeOutLevel5)
{
e.Appearance.BackColor = Color.FromArgb(, , );//设置背景色
}
else if (iMinutes > iTimeOutLevel5 && iMinutes <= iTimeOutLevel6)
{
e.Appearance.BackColor = Color.Red;//设置背景色
}
else if (iMinutes > iTimeOutLevel6)
{
e.Appearance.BackColor = Color.Crimson;//设置背景色
}
e.Appearance.ForeColor = Color.Black; //设置字体颜色
}

C# - Winform - DevExpress - GridControl 任意条件控制Row背景色。的更多相关文章

  1. DevExpress控件-GridControl根据条件改变单元格(Dev GridControl 单元格着色)

    DevExpress控件-GridControl根据条件改变单元格颜色,如下图: 解决办法:可以参考:http://www.cnblogs.com/zeroone/p/4311191.html 第一步 ...

  2. DevExpress GridControl使用方法

    一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 (1).gridView.AddN ...

  3. DevExpress GridControl 使用方法技巧 总结 收录整理

    一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 ().gridView.AddNe ...

  4. C# DevExpress GridControl使用方法

    一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 ().gridView.AddNe ...

  5. [转载]DevExpress GridControl 使用方法技巧 总结 收录整理

    最近开始用DevExpress组件,发现很好的经验总结博客,在这里转载分享 原作者:https://www.cnblogs.com/wordgao/p/4517011.html 一.如何解决单击记录整 ...

  6. DevExpress GridControl使用(转)

    DevExpress GridControl使用 (一)原汁原味的表格展示 Dev控件中的表格控件GridControl控件非常强大.不过,一些细枝末节的地方有时候用起来不好找挺讨厌的.使用过程中,多 ...

  7. Devexpress GridControl z

    http://minmin86121.blog.163.com/blog/static/4968115720144194923578/ 1 AllowNullInput=False; --Devexp ...

  8. Scala学习教程笔记一之基础语法,条件控制,循环控制,函数,数组,集合

    前言:Scala的安装教程:http://www.cnblogs.com/biehongli/p/8065679.html 1:Scala之基础语法学习笔记: :声明val变量:可以使用val来声明变 ...

  9. DevExpress GridControl+UserControl实现分页

    志向不过是记忆的奴隶,生气勃勃地降生,但却很难成长. —— 莎士比亚 时隔一年,我写随笔真的很随意,想起了就来博客园写写,想不起来就任由懒惰支配着我.不过我到觉得这不是什么坏事,你不用为了完成某事而让 ...

随机推荐

  1. MySQL Tools 之 mysql.server 脚本运用

    MySQL distributions on Unix and Unix-like system include a script named mysql.server, which starts t ...

  2. springcloud学习之路: (二) springcloud打jar包并批量运行

    springcloud中内置了tomcat所以打包的时候是直接把tomcat打入jar包 之后就可以做到, 单独的服务, 独立的jar包, 独立运行的效果了. 一.打jar包 1. 在pom.xml文 ...

  3. Scala比较器---Ordered与Ordering

    1.Ordered 和 Ordering Scala提供两个特质(trait)Ordered与Ordering用于比较.其中,Ordered混入(mix)Java的Comparable接口,而Orde ...

  4. Python 函数小程序初解

    目录 作业 ==程序代码自上往下运行,建议自上而下的完成下列任务== 作业 文件a.txt内容:每一行内容分别为商品名字,价钱,个数,求出本次购物花费的总钱数 sum = 0 f = open('a. ...

  5. 201871010106-丁宣元 《面向对象程序设计(java)》第七周学习总结

    201871010106-丁宣元 <面向对象程序设计(java)>第七周学习总结 正文开头: 项目 内容 这个作业属于哪个课程 https://home.cnblogs.com/u/nwn ...

  6. csp 201409-3 字符串匹配

    问题描述: 很简单,判断给定串是否在目标串中出现.分区分大小写和不区分大小写两种情况. csp特点: csp的第三题一般是字符串的处理,c++的string类虽然不好用,但是掌握的话在考试的时候可能能 ...

  7. Hbase多条件查询数据(FilterList)

    利用Filter进行筛选:HBase的Scan可以通过setFilter方法添加过滤器(Filter),这也是分页.多条件查询的基础.HBase为筛选数据提供了一组过滤器,通过这个过滤器可以在HBas ...

  8. Linux学习笔记-第3天 - 勤能补拙

    学一门技术,基础一定要打牢,多练习是关键,还要尽可能理解其背后的知识.并时刻提醒自己,求知若饥,虚心若愚.

  9. Centos7下搭建NFS服务器与连接详解

    一,环境介绍    本实验使用了两台centos7虚拟机,其中         服务器:192.168.1.188    客户端:192.168.1.189 二,实验步骤    192.168.1.1 ...

  10. [LeetCode] 236. Lowest Common Ancestor of a Binary Tree 二叉树的最小共同父节点

    Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According ...