Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CWnd Flicker when resizing a window

Posted on 2003-11-14
5
Medium Priority
?
1,410 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 750 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

715 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