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; 
                   } 
               } 
           }
  • 相关阅读:
    使用Application Insights 做分析
    UWP中GridView右击选中的实现
    Bing Map
    UWP深入学习六:Build better apps: Windows 10 by 10 development series
    从上往下打印二叉树
    二叉树中和为某一值的路径
    二叉树的镜像
    树的子结构
    由前序遍历和中序遍历构建二叉树
    二叉树常见题目
  • 原文地址:https://www.cnblogs.com/yongfeiuall/p/4134164.html
Copyright © 2011-2022 走看看