I'm programming a print preview window. I create class for the window with CS_OWNDC, and without VREDRAW and HREDRAW to avoid flickering.
Then I create the window with WS_OVERLAPPEDWINDOW OR WS_VSCROLL OR WS_CLIPCHILDREN and I create a rebar in this window.
During WM_PAINT I paint the client area from a BackBuffer.
I have copied the example from microsoft "Example of Scrolling Text".
The WM_HSCROLL handler is the same but WM_PAINT is different because I don't have to paint strings but a bitmap.

The problem is that the ClipRect is strange.

On start the clip rect is
left = 0
top = 26
right = 1135
bottom = 812
that is the client area without the rebar
(these values are taken from ps.rcPaint)

If I click on the down arrow of the scroll bar
left = -50
top = 728
right = 1085
bottom = 738

And if I click the up arrow
left = -50
top = -48
right = 1085
bottom = -38

Why these negative values?

Why I get the WM_PAINT message even if the clipping region is 0?
Posted on 2004-09-25 05:20:06 by greenant
I found the answer to the first question. I use SetViewportEx to change the origin.

But I still can't find an answer to the second question.
How can I prevent my window from getting WM_PAINT when the clip rect is ZERO?
Posted on 2004-09-25 08:48:53 by greenant