Hey Guys,
I'm writing paint handler that handles painting the BG and foreground of a control. I'm using GetDCEx() to paint to the control and ValidateRect() afterward to make sure the WM_PAINT message isn't sent all the time. I also use GetUpdateRgn() to set up the clipping region so that it only paints where it needs to.
This all works fine and dandy up until the point I start moving a window above mine. At first it seems fine, but every so often it will leave bits from the window above.
I can't seem to nail down why this is happening.
Any ideas/thoughts?
...and using BeginPaint/EndPaint is not the solution I am looking for.
[Win32] GetDC and ValidateRect in WM_PAINT
Well, what's happening is your WM_PAINT handler isn't painting some region that it needs to paint. This probably has to do with your calls to ValidateRect. If you take out all calls to ValidateRect does the painting bug still occur?
EDIT: Just read your post more closely ... so are you painting outside of BeginPaint()/EndPaint() when handling WM_PAINT? Why?
EDIT: Just read your post more closely ... so are you painting outside of BeginPaint()/EndPaint() when handling WM_PAINT? Why?
Yes, actually. I was thinking it might be the validation, but when I validate the only the update region as opposed to the entire client area, it still does the same. So I'm confused, if the update region is what needs to be updated, and I validate it, that should do it...
Post some code...
But basically your WM_PAINT handler should be painting to the HDC returned from BeginPaint(), period. Are you not doing this?
But basically your WM_PAINT handler should be painting to the HDC returned from BeginPaint(), period. Are you not doing this?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement