zoukankan      html  css  js  c++  java
  • C#



     1 private void gvSendConfirm_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
     2         {
     3             string sCurrTime=DbHelperSql.GetSingle("Select GetDate() DateNow").ToString();
     4             DateTime dtCurrTime,dtSendTime;
     5             int iMinutes = 0;
     6             try
     7             {
     8                 dtCurrTime=DateTime.Parse(sCurrTime);
     9             }
    10             catch (System.Exception ex)
    11             {
    12             dtCurrTime=DateTime.Now;
    13             }
    14 
    15             string sSendTime= gvSendConfirm.GetDataRow(e.RowHandle)["UpdateTime"].ToString();
    16             try
    17             {
    18                 dtSendTime = DateTime.Parse(sSendTime);
    19             }
    20             catch (System.Exception ex)
    21             {
    22                 dtSendTime = DateTime.Now;
    23             }
    24 
    25             //计算时间差。
    26             System.TimeSpan difTime = dtCurrTime.Subtract(dtSendTime);
    27             iMinutes = difTime.Minutes;
    28 
    29             if (iMinutes <= iTimeOutLevel1)
    30             {
    31                 e.Appearance.BackColor = Color.White;   //设置背景色
    32             }
    33             else if (iMinutes > iTimeOutLevel1 && iMinutes <= iTimeOutLevel2)
    34             {
    35                 e.Appearance.BackColor = Color.FromArgb(192, 192, 255);//设置背景色
    36             }
    37             else if (iMinutes > iTimeOutLevel2 && iMinutes <= iTimeOutLevel3)
    38             {
    39                 e.Appearance.BackColor = Color.FromArgb(128, 255, 128);//设置背景色
    40             }
    41             else if (iMinutes > iTimeOutLevel3 && iMinutes <= iTimeOutLevel4)
    42             {
    43                 e.Appearance.BackColor = Color.FromArgb(255, 192, 128);//设置背景色
    44             }
    45             else if (iMinutes > iTimeOutLevel4 && iMinutes <= iTimeOutLevel5)
    46             {
    47                 e.Appearance.BackColor = Color.FromArgb(255, 128, 128);//设置背景色
    48             }
    49             else if (iMinutes > iTimeOutLevel5 && iMinutes <= iTimeOutLevel6)
    50             {
    51                 e.Appearance.BackColor = Color.Red;//设置背景色
    52             }
    53             else if (iMinutes > iTimeOutLevel6)
    54             {
    55                 e.Appearance.BackColor = Color.Crimson;//设置背景色
    56             }
    57             e.Appearance.ForeColor = Color.Black; //设置字体颜色
    58         }
  • 相关阅读:
    mybatis源码(八) Mybatis中的#{} 和${} 占位符的区别
    mybatis源码(七)mybatis动态sql的解析过程下篇
    mybatis源码(六)mybatis动态sql的解析过程上篇
    JDBC的API介绍
    mybatis源码(五)mybatis日志实现
    jmeter: 报错锦集
    python3升级后pip提示TLS/SSL错误问题
    Pytest+Jenkins+Allure
    建议
    Android Studio Button事件的三种方式
  • 原文地址:https://www.cnblogs.com/kliine/p/9246736.html
Copyright © 2011-2022 走看看