private void fileview_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {            MessageBox.Show(fileview.Rows.Count.ToString());        }总是不停的弹出提示

解决方案 »

  1.   

    在绘制 DataGridViewRow 后发生因为你可能有多个DataGridViewRow 
      

  2.   

    因为,警告框显示出来后,遮挡住了界面,关闭警告框后,界面恢复,需要重新绘制,
    所以再次触发RowPostPaint,所以又弹警告框。。无穷无尽。
      

  3.   

    还真是这样子啊
    我是想在datagridview里想加一列序号,才用这个事件的
    还是别人告诉我这样做的
     private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) 
            { 
                foreach (DataGridViewRow row in dataGridView1.Rows) 
                { 
                    row.Cells[0].Value = row.Index+1; 
                } 
            } 
      

  4.   

    为什么都喜欢用dataGridView1_RowPostPaint这个事件呢其实当鼠标移动到datagridveiw上时,这个事件就会执行,那么用户是界面上是会不停的移动的鼠标的啊
      

  5.   

    页面回调了吧,建议加入放到updatepanel中