Sign in to follow this  
Noods

Screen invalidation when switchinbg tabs...

Recommended Posts

Win32/C++ In order to prevent tearing in my program I have set the last argument of all my InvalidateRect(); calls to false and handled my drawing with buffering. However, when I switch between my three tabs, I see the background color of my program "tear" through for a brief second. This is the behavior one sees when the last argument of InvalidateRect(); is set to true. Is there some part of the Win32 tab controls that inherently sends a request to invalidate the whole window?

Share this post


Link to post
Share on other sites
Is your drawing taking place within the tab window?
If so, is it actually done to the tab control HWND, or to a child window?
If it's done to a child window, make that child window not have a background brush, and set the tab control window style to include WS_CLIPCHILDREN. (If you draw to the actual tab control, then it's harder, since the tab control has no way of knowing which parts of it you will cover with your own drawing, and therefore has to redraw the whole background. It doesn't sound as though this is the case..)
It's also possible that you have several child windows, which is an often used technique for multiple tabs. If that is so, make sure to not hide the windows one at a time, and then show the new active tab window, since that can make the background shine through for a short time in between hiding and showing.

Share this post


Link to post
Share on other sites
The buttons that are redrawn are child windows which are not drawn to the tab. The tab control itself only takes up about 1/4 of the window. However, the whole window is being invalidated, not just the buttons or tab control. I think that is more of the overall problem.

Share this post


Link to post
Share on other sites
I fixed this by handling the WM_ERASEBKGND message. I still have some small issues but I will deal with those at another time. Thanks for the suggestions!

Share this post


Link to post
Share on other sites
I have fixed most of this problem. However, I am still seeing slight tearing on one part of my window. It isn't the overall background or the buttons within a tab. I am seeing tearing on the blank portion of the tab itself. The buttons draw properly, it is the actual tab that is tearing.

Share this post


Link to post
Share on other sites
I suspect I may be seeing this tearing due to the background color not being set properly even though it has been specified previously. Does anyone know of a way to check what background color a win32 program is currently set to?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this