I use the MFC list control in report view with grid lines to display data in a vaguely spreadsheet manner.
Sometimes when the user scrolls vertically through the control, extra grid lines are drawn, which looks terrible.
This does not happen when the slider or the mousewheel are used to scroll, only when the little down arrow button at the bottom of the scroll control is used.
It seems that this occurs when the size of the list control window is not an exact even number of rows, so that a partial row is visible at the bottom.
If I adjust the size of the list control so that there is no partial rows visible, the problem is solved. However, it will appear when the program is run on another computer, presumably because the number of pixels occupied by a row changes.
I am assuming that it is an interaction between screen resolution, font size and ‘dialog units’.
I guess that I need to programmatically force the size of the control when it is created. But what size?
I have tried using the ApproximateViewRect() method but I cannot get it to work. Perhaps this method does not know about report view?
The other method, I suppose, would be to create my own specialization of CListCtrl and over-ride whatever method is doing the scrolling. This seems likely to be a lot of work.
This screenshot shows a closely related problem where the grid lines go missing

and here is one with the extra grid lines

The only difference between these two and between them and one which scrolls perfectly is a few pixels different in the vertical size of the control.
To fix this bug in the MFC List Control you need to specialize the control, over-ride the method wich responds to the scroll, and force it to redraw the list completely after it has done the scroll.
interface header
implementation: