• [唐胡璐] 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; 
                   } 
               } 
           }
  • 相关阅读:
    147-SpirngBoot指定编译那个文件的xml文件?
    146-springboot打war包设置
    145-sprinboot导入的内嵌jsp依赖是什么?
    mybatis中映射文件和实体类的关联性
    Quartz使用-入门使用(java定时任务实现)
    java SSLContext
    方法参数传递
    JSP写的图书管理系统
    JAVA---数组
    SpringBoot 2.x 后WebMvcConfigurationAdapter 过时
  • 原文地址:https://www.cnblogs.com/yongfeiuall/p/4134164.html
Copyright © 2020-2023  润新知