How to get rid of ugly repainting process when resizing main window?
-
Hi, I've SDI application I start with SW_MAXIMIZE parameter passed to CFrameWnd::ShowWindow(). But I absolutely don't like that while the window is appearing on the screen, user can see its repainting progress (two ListViews changing their size, toolbar changing its size etc..). And it looks very ugly. Is there any way how to get rid of this? For example Visual C++ has very nice repainting when changing size/maximizing - there are no "intermediate stages" of repainting progress that could be seen by user. I think there must be some way how to do it - let all parts of application window (toolbars, views, ....) to find out their dimensions and placement BUT don't show main window untill this all is done! Hope someone will understand my problem... Thank you for any suggestion.
-
Hi, I've SDI application I start with SW_MAXIMIZE parameter passed to CFrameWnd::ShowWindow(). But I absolutely don't like that while the window is appearing on the screen, user can see its repainting progress (two ListViews changing their size, toolbar changing its size etc..). And it looks very ugly. Is there any way how to get rid of this? For example Visual C++ has very nice repainting when changing size/maximizing - there are no "intermediate stages" of repainting progress that could be seen by user. I think there must be some way how to do it - let all parts of application window (toolbars, views, ....) to find out their dimensions and placement BUT don't show main window untill this all is done! Hope someone will understand my problem... Thank you for any suggestion.
There are 3 things to look at wrt window repainting/flickering : 1. WM_ERASEBKGND - if you are drawing the control and repaint the entire area in your WM_PAINT handler then don't do anything in WM_ERASEBKGND (and return 1). This avoids flicker caused by WM_ERASEBKGND filling control with background color then WM_PAINT painting actual control detail. 2. Again, if you are painting the control, then think about rendering the control to a bitmap then bliting the bitmap to the screen. 3. If you need to reposition a number of windows at once try using BeginDeferWindowPos(), DeferWindowPos(), and EndDeferWindowPos(). This is usefull for splitter windows. 4. (ok, 4 things to look at) For initial display you could create all windows hidden, position them, then make them all visible. Another way is to create main window offscreen then when children have adjusted their sizes, move main window onscreen. ...cmk Save the whales - collect the whole set
-
Hi, I've SDI application I start with SW_MAXIMIZE parameter passed to CFrameWnd::ShowWindow(). But I absolutely don't like that while the window is appearing on the screen, user can see its repainting progress (two ListViews changing their size, toolbar changing its size etc..). And it looks very ugly. Is there any way how to get rid of this? For example Visual C++ has very nice repainting when changing size/maximizing - there are no "intermediate stages" of repainting progress that could be seen by user. I think there must be some way how to do it - let all parts of application window (toolbars, views, ....) to find out their dimensions and placement BUT don't show main window untill this all is done! Hope someone will understand my problem... Thank you for any suggestion.
The window class is handling that for you. If you are using MFC, window classes are generally hidden from you. The flags you want to change are CS_HREDRAW and CS_VREDRAW. These flags tell windows to repaint the window when it changes size. At least I think that is the case. :) Tim Smith I'm going to patent thought. I have yet to see any prior art.
-
Hi, I've SDI application I start with SW_MAXIMIZE parameter passed to CFrameWnd::ShowWindow(). But I absolutely don't like that while the window is appearing on the screen, user can see its repainting progress (two ListViews changing their size, toolbar changing its size etc..). And it looks very ugly. Is there any way how to get rid of this? For example Visual C++ has very nice repainting when changing size/maximizing - there are no "intermediate stages" of repainting progress that could be seen by user. I think there must be some way how to do it - let all parts of application window (toolbars, views, ....) to find out their dimensions and placement BUT don't show main window untill this all is done! Hope someone will understand my problem... Thank you for any suggestion.
Additionally, make sure your view and controls have the
WS_CLIPCHILDREN|WS_CLIPSIBLINGS
styles --Mike-- "Big handwavy generalizations made from a position of deep ignorance is one of the biggest wastes of time on the net today. -- Joel Spolsky Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber