Solved

CWnd Flicker when resizing a window

Posted on 2003-11-14
5
1,403 Views
Last Modified: 2013-11-20
I have a class derived off of CWnd (CDataTable).

I have the application setup in such a way that when you resize the main window, the CDataTable object will also scale to fit a specified ratio of the screen.

The problem is, when I resize the window, and the CDataTable resizes, the data table produces a flicker effect.

I have tried adding a double-buffer to the CDataTable's WM_PAINT message before painting, but it doesn't affect anything.

I am hoping to figure out either how to stop the flicker, or an easy way to display a flicker free bounding region in place of the entire table when resizing.  Essentially, I need absolutely NO FLICKER;
0
Comment
Question by:r2far
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Dexstar
ID: 9751872
r2far:

> I am hoping to figure out either how to stop the flicker, or an easy way to
> display a flicker free bounding region in place of the entire table when
> resizing.  Essentially, I need absolutely NO FLICKER;

Have you tried overriding OnEraseBkGnd() and returning TRUE to block the default erasing process?  That's helped me out a lot in the past.

Hope That Helps,
Dex*
0
 
LVL 19

Expert Comment

by:Dexstar
ID: 9751885
0
 
LVL 4

Author Comment

by:r2far
ID: 9752086
I had already overriden OnEraseBackground() and returned true from it before the base class call.

The link helps but doesn't completly solve my problem.

I can use 'LockWindowUpdate();' to prevent redraw of the object while resizing, but I was hoping to at least have a minimal bounding region to show how the CWnd object is being resized as the user resizes the entire application.

I think what I need is something to inicate when resizing hs stopped.  then I could use that and the OnSize() message to control when I display the full screen, or when I display the bounding region only.

I am getting closer to a solution though
0
 
LVL 4

Author Comment

by:r2far
ID: 9752091
If I can get the application to tell me when sizing starts and when sizing ends, i can actually draw the bounding region using the view.  But I need those start and end points.
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 250 total points
ID: 9753476
Hi r2far,


try calling
      SetClassLong( m_hWnd, GCL_STYLE, GetClassLong( m_hWnd, GCL_STYLE ) & ~( CS_HREDRAW | CS_VREDRAW ));
within a function of the CWnd after window is created (i.e. in an overridden Create)

Lot of windows have by default set the class styles CS_HREDRAW | CS_VREDRAW which indicate the window is
comleteley redrawn when horizontal or vertical resized.

WM_SIZE message is generated while resizing if windows is set to draw windows while move/size ... so WM_SIZE
handler is not a start/end point of re-sizing ...

You can IMO use WM_NCLBUTTONDOWN/WM_NCLBUTTONUP to get start/end point of resize action

hope that helps,

ZOPPO
0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question