C# - Winform - DevExpress - GridControl 任意条件控制Row背景色。
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背景色。的更多相关文章
- DevExpress控件-GridControl根据条件改变单元格(Dev GridControl 单元格着色)
DevExpress控件-GridControl根据条件改变单元格颜色,如下图: 解决办法:可以参考:http://www.cnblogs.com/zeroone/p/4311191.html 第一步 ...
- DevExpress GridControl使用方法
一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 (1).gridView.AddN ...
- DevExpress GridControl 使用方法技巧 总结 收录整理
一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 ().gridView.AddNe ...
- C# DevExpress GridControl使用方法
一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 ().gridView.AddNe ...
- [转载]DevExpress GridControl 使用方法技巧 总结 收录整理
最近开始用DevExpress组件,发现很好的经验总结博客,在这里转载分享 原作者:https://www.cnblogs.com/wordgao/p/4517011.html 一.如何解决单击记录整 ...
- DevExpress GridControl使用(转)
DevExpress GridControl使用 (一)原汁原味的表格展示 Dev控件中的表格控件GridControl控件非常强大.不过,一些细枝末节的地方有时候用起来不好找挺讨厌的.使用过程中,多 ...
- Devexpress GridControl z
http://minmin86121.blog.163.com/blog/static/4968115720144194923578/ 1 AllowNullInput=False; --Devexp ...
- Scala学习教程笔记一之基础语法,条件控制,循环控制,函数,数组,集合
前言:Scala的安装教程:http://www.cnblogs.com/biehongli/p/8065679.html 1:Scala之基础语法学习笔记: :声明val变量:可以使用val来声明变 ...
- DevExpress GridControl+UserControl实现分页
志向不过是记忆的奴隶,生气勃勃地降生,但却很难成长. —— 莎士比亚 时隔一年,我写随笔真的很随意,想起了就来博客园写写,想不起来就任由懒惰支配着我.不过我到觉得这不是什么坏事,你不用为了完成某事而让 ...
随机推荐
- 6、Routing
Routing In the previous tutorial we built a simple logging system. We were able to broadcast log mes ...
- 更换Ubuntu软件源
对于Ubuntu系统, 不同的版本的源都不一样,每一个版本都有自己专属的源. 而对于 Ubuntu 的同一个发行版本,它的源又分布在全球范围内的服务器上.Ubuntu 默认使用的官方源的服务器在欧洲, ...
- Rust中的哈希Map
严谨! fn main() { use std::collections::HashMap; let mut scores = HashMap::new(); scores.insert(String ...
- WordPress隐藏后台左侧菜单如何操作
前面我们讲了wordpress后台添加左侧边栏菜单如何操作,反过来如果想要隐藏一些菜单怎么实现呢?我们可以通过remove_menu_page()函数来完成,将如下代码加入到当前主题function. ...
- Revit 2019 下载链接
[安装环境]:win7/win8/win10 [64位下载] 百度网盘链接:pan.baidu.com/s/1Vq5Cnyj1G-oMNup_sXvxfQ 提取码:d6xd
- java.util.Base64
Base64 简单使用 java.util.Base64 package com.mozq.sb.jwt01.config; import java.nio.charset.Charset; impo ...
- 网络yum源配置
系统环境:CentOS7 [1] 首先备份/etc/yum.repos.d/CentOS-Base.repo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum ...
- zr2019暑期高端峰会AB组十测
郑睿round 1 代码真的好写,还是太笨了,爆零了. 郑睿round_2 好失败,A题真的是日狗了,第一发就可以A的,忘记费用流的反向边也要加一发流量了.哎,我注定是要爆零. 正睿round_3 日 ...
- 性感VSCODE在线刷LeetCode的题
安装Nodejs并勾选添加到PATH VSCODE安装插件LeetCode 注册LeetCode账号(注意CN国区和国际区账号不通用),重启VSCODE并点左边栏那个LeetCode图标sign in ...
- SpringBoot-dubbo自定义负载均衡实现简单灰度
本文介绍如何利用dubbo自定义负载实现简单灰度(用户纬度,部分用户访问一个服务,其余访问剩余服务). 其实在这之前,对dubbo了解的也不是很多,只是简单的使用过,跑了几个demo而已,但是得知接下 ...