DataGridView.CellPainting -- when is this thrown?

  • Thread starter Thread starter slikrik
  • Start date Start date
S

slikrik

Guest
Greetings,

I have a DataGridView for which I am trying to improve the performance -- it has a lot of data that is rapidly updating, some of the cells are formatted depending on the value within the cell (or some other, outside factor). Because of this, I handle the DataGridView.CellPainting event and do some custom drawing (sometimes I draw a box around the cell, sometimes I change the Forecolor of the text, etc.).

I assumed that this event was thrown (a) whenever the cells content changed, or (b) whenever the cell was made visible from an invisible state (e.g. you scroll the DGV and a cell is scrolled into view).

But it appears that this event is being called in some other case -- the cells value isnt changing, and Im not even touching the DataGridView, yet occasionally Ill get a CellPainting event thrown for the static cell in question.

I think if I can solve this issue, I will be able to greatly improve the performance of my DataGridView, especially when there are hundreds of rows. Thanks.

Rick

Continue reading...
 
Back
Top