zoukankan      html  css  js  c++  java
  • [唐胡璐] winform中改变DataGridView中符合条件的字体的颜色

    把QTP Report中的运行结果状态根据结果显示为不同的颜色:

    private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) 
           { 
               if (e.RowIndex < 0) 
                   return; 
     
               if (e.ColumnIndex == dataGridView1.Columns["CaseStatus"].Index) 
               { 
                   if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Passed") 
                   { 
                       e.CellStyle.ForeColor = Color.Green; 
                   } 
                   else if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Failed") 
                   { 
                       e.CellStyle.ForeColor = Color.Red; 
                   } 
                   else if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Warning") 
                   { 
                       e.CellStyle.ForeColor = Color.Goldenrod; 
                   } 
                   else if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "No Run") 
                   { 
                       e.CellStyle.ForeColor = Color.Gray; 
                   } 
               } 
           }
  • 相关阅读:
    [Caffe] ubuntu14.04下使用OpenBLAS加速Caffe
    [CUDA] ubuntu14.04+cuda7.5下安装cudnn7.0
    ubuntu下virtualenv的复制
    SIFT特征学习笔记
    ubuntu14.04+opencv 3.0+python2.7安装及测试
    django之ORM
    django之路由(url)
    性能调优之MySQL篇四:MySQL配置定位以及优化
    性能调优之MySQL篇三:MySQL配置定位以及优化
    性能调优之MySQL篇二:MySQL配置文件My.ini配置文件优化
  • 原文地址:https://www.cnblogs.com/yongfeiuall/p/4134164.html
Copyright © 2011-2022 走看看