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. Eric6 黑色风格配置

    界面风格-黑色主题 1.设置-首选项-界面-风格选择Fusion,再配置题样式表选择路径下的eric6\Styles选择[Chinese_Dark.qss]进行修改. ​ 编辑器风格 2.选择完毕后, ...

  2. 通过premake生成vs工程文件

    visual studio的工程视图,在引用外部目录时非常麻烦,这时候可以使用premake一键生成工程文件,自动配置好工程的各种属性,还有目录的组织结构. 示例:如下是一个c++的外部目录结构,我们 ...

  3. Dev-C++之调试

    参考这个博客https://blog.csdn.net/qq_38737992/article/details/77621299,解决了问题

  4. MySQL拓展 视图,触发器,事务,存储过程,内置函数,流程控制,索引,慢查询优化,数据库三大设计范式

    视图: 1.什么是视图 视图就是通过查询得到一张虚拟表,然后保存下来,下次直接使用即可 2.为什么要用视图 如果要频繁使用一张虚拟表,可以不用重复查询 3.如何使用视图 create view tea ...

  5. Win10打开控制面板的方式

    Win10打开控制面板的方式方式1:1.打开运行框    windows键 + R2.在运行框中输入 control 方式2:右击开始图标->控制面板 方式3:在命令行cmd中输入 contro ...

  6. Nginx 环境搭建 (windows)

    Nginx 环境搭建 (windows) 资源 # nginx在线文档和支持 For online documentation and support please refer to nginx.or ...

  7. Docker底层原理(三)

    1. 我们运行:docker run hello-world 由于本地没有hello-world,所以会远程下载一个hello-world的镜像,并在容器内运行. 2. docker run干了什么?

  8. VIJOS-P1292 火车票

    JDOJ 1404: VIJOS-P1292 火车票 https://neooj.com/oldoj/problem.php?id=1404 Description 一个铁路线上有n(2< =n ...

  9. webapi中获取HttpContext

    public OperationResultDto APILogin() { LoginModel model = new LoginModel(); HttpContextBase context ...

  10. 怎么写Java项目?

    我们通常说的Java项目也都是JavaWeb,J2ee项目;现在说的是JavaWeb. 最简单的办法 多看别人项目源码 在别人基础上修改,而现在要一点一点掰开看看. 1.立项: 要做什么东西,最后的要 ...