• 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         }
  • 相关阅读:
    通过ADB命令查看当前Android运行程序的页面信息
    C#中发起GET和POST请求的方法
    CocoaPods使用
    Carthage使用
    Mac终端常用命令和操作
    Mac OS环境变量配置
    Mac OS包管理器Homebrew
    js利用localStroage实现一个页面栈
    vue-cli快速搭建Vue脚手架 (vue-cli 3.x 模板)
    yarn和npm常用命令
  • 原文地址:https://www.cnblogs.com/kliine/p/9246736.html
Copyright © 2020-2023  润新知