I have tried MSDN - ended up more confused unfortunately.
For example I cannot tell from MSDN if update region and invalid rectangle are the same.
Quote from: bf2 on October 17, 2012, 01:58:51 AM
I have tried MSDN - ended up more confused unfortunately.
i hear ya - lol
there is a lot of material to cover when it comes to painting and drawing
read it - read it again - and again - and again :P
play with it along the way
the update region is a collection of invalidated regions
the OS keeps track of the update region
you can invalidate a region or a rectangle (usually the latter)
doing so causes the OS to "add that region to the pile", so to speak
when a WM_PAINT message is sent to a window, the collective total rectangle is sent via PAINTSTRUCT
the BeginPaint/EndPaint sequence clears the collective update region
notice that the update region can include things like windows moving on top of each other, as well as you drawing
you can also validate regions or rectangles to remove them from the pile
a clipping rectangle is a more general term that is used in many ways
for example, if i draw text that extends beyond the window boundry, it is clipped
or - if i have 2 child windows that overlap each other, one of them may be clipped
it can help reduce CPU usage if you only update the rectangle specified in PAINTSTRUCT
for beginners, it is convenient to ignore this and just update the entire window
it makes the code easier to write
but, once you have the hang of it, you will want to add code that limits the update to PAINTSTRUCT.rcPaint