Scrolling Invalidation

For usual scroll bar (SetScrollInfo, GetScrollInfo, ScrollWindow) functionality, after a scroll action, what portion of the client area is invalidated?

In future, how could I find this information? I couldn't find it on MSDN.
It is in MSDN Online:

The area uncovered by ScrollWindow is not repainted, but it is combined into the window's update region. The application eventually receives a WM_PAINT message notifying it that the region must be repainted. To repaint the uncovered area at the same time the scrolling is in action, call the UpdateWindow function immediately after calling ScrollWindow.


That extract is from http://msdn.microsoft.com/en-us/library/bb787591(VS.85).aspx . Maybe you did not know that the update region is the invalidated portion of the window.
You are right, I didn't know what the update region meant.

But this conflicts with my current knowledge. (Ch. 4 Petzold)

If I have a simple scrolling application, and I scroll it down one line, then only one line of the client area is invalidated. But the entire client area changes by means of an HDC from BeginPaint. The HDC from BeginPaint can only edit the invalidated area, i.e., not the entire client area.

Where am I going wrong? UpdateWindow doesn't change invalidated area, does it? It just sends a WM_PAINT to the front of the line.
Deathly wrote:
But the entire client area changes by means of an HDC from BeginPaint.


I don't understand what you mean with this. BeginPaint() doesn't change or invalidate anything. It just starts up the painting process. AFAIK, any painting in the hDC will be confined to the update region, which should be whatever new portion the ScrollWindow() function uncovered.

So maybe you are not aware that ScrollWindow() actually moves the "image" of the window up, down, left or right, assuming the contents at the time ScrollWindow() is called are accurate. Under this assumption, no part of the client area is invalidated EXCEPT for the newly "uncovered" area.

I'm not sure if I explained that well enough.
Thanks. I didn't realize that ScrollWindow actually shifted everything. Since the program used PAINTSTRUCT.rcPaint to determine where repainting was, shifting or not shifting would have been interpreted the same way by my program.
Topic archived. No new replies allowed.