Replies To: problem with scroll bar "the window content get repeated"

Re: problem with scroll bar "the window content get repeated"

Posted 05 October 2012 - 03:44 PM

Since you are doing your own painting in your WM_PAINT, you are also responsible for erasing your own background area. So you'll have to do something like a FillRect() with the brush set to your background color.

First of all I wouldn't use ScrollWindow for this better using ScrollWindowEx as ScrollWindow is primarily used
in scrolling text also UpdateWindow is a bit hit and miss better off using InvalidateRect
then you need to update WM_PAINT with the new rectangele coords everytime you scroll you should be updating the rectangle coords to a new postion and of course erasing either a portion of the screen or the entire screen.

Your going to want to set up a RECT to hold the co-ords of your rectangle.

then in your scroll routines your going to have to update them something like this