我查了一下,ydsunny(小强)   (   )是web的解决方法,在winform里,DataGridView没有RowDataBound事件,如果在winform里,如下修改: 


private   void   dataGridView1_RowPrePaint(object   sender,   DataGridViewRowPrePaintEventArgs   e) 
                { 
                        if   (e.RowIndex   > =   dataGridView1.Rows.Count   -   1) 
                                return; 
                        DataGridViewRow   dgr   =   dataGridView1.Rows[e.RowIndex]; 
                        try 
                        { 
                                if   (dgr.Cells[ "列名 "].Value.ToString()   ==   "比较值 ") 
                                { 
                                        dgr.DefaultCellStyle.ForeColor   =   设置的颜色; 
                                } 
                        } 
                        catch   (Exception   ex) 
                        { 
                                MessageBox.Show(ex.Message); 
                        } 
                }

相关文章:

  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
猜你喜欢
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案