Solved

CWnd Flicker when resizing a window

Posted on 2003-11-14
5
1,381 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
  • 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 177
Include multiple hostnames in this command? 3 55
only14 challenge 19 76
Work with App store 7 52
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

776 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