private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value = imageList1.Images[0];
}这样显示的图片闪个不停 怎么了?????????????请教

解决方案 »

  1.   

    每绘制一个单元格,就会发生 CellFormatting 事件,因此,处理此事件时应避免时间过长。在检索单元格 FormattedValue 或调用其 GetFormattedValue 方法时,此事件也会发生。可能是导致了这个出现.....
      

  2.   

    你有没有发现你的CUP占用率居高不下。。
    因为你在CellFormatting里改变Value值导致控件刷新,而刷新有要调用CellFormatting。。
    应该使用DataGridViewCellFormattingEventArgs.Value=imageList1.Images[0];
      

  3.   

    这样可以达到你要的效果。
    事件里面的编程要注意如果EventArgs提供了这样的东西你用这个比较省心。
            private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
            {
                this.dataGridView1[0, 0].Value = this.imageList1.Images[0];
            }
      

  4.   

    写错了
    private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
    {
    e.Value = this.imageList1.Images[0];
    }