I just re-reported this in in QC as 81060, but wanted to let you know that there is a bug in TCustomGrid.InvalidateCol and TCustomGrid.InvalidateRow which has been there since at least Delphi 4 Delphi 1 (InvalidateRow) and Delphi 2 (InvalidateCol) and still present in Delphi 2010.
Both methods will not invalidate the entire Row/Col but only the Left/Top most cells of that Row/Col.
So the invalidate the absolute rectangle in stead of the visible rectangle.
You will see this behaviour when you have a virtual grid that is larger than the actual grid on the screen, you scroll through that grid, and perform your own drawing.
Boths bugs are easy to fix, have been reported in QC as number 8472 before (and reported even before QC existed), but denied as ‘test case error’ in stead of being investigated further.
The earliest reference I could find on them is as number 531 in the Delphi Buglist, by Rune Moberg, long time and well respected Delphi developer and bikedude.
Some of the 3rd party grid vendors are also to blame: they seemed to have worked around it without pressing the Delphi team to solve the issue.
For instance, the infamous rxgrid, just invalidates all Rows within InvalidateCol. Now that is pure overkill, as my solution will show. Read the rest of this entry »