Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VC++ : Turning off Background Erase

Posted on 1997-11-22
1
Medium Priority
?
352 Views
Last Modified: 2010-07-27
  I'm calling CDocument::UpdateAllViews() in an MDI application. My main view class (of 2) uses an offscreen bitmap for double buffering, so I need to know how to switch off the background erase.
  I know about the bErase parameter of CView::InvalidateRect() - I need something equivalent. The double buffering technique uses OnInitialUpdate() and OnPaint() in the View class.
   Any help would be much appreciated.
0
Comment
Question by:woolie
1 Comment
 
LVL 7

Accepted Solution

by:
galkin earned 300 total points
ID: 1173883
When you redraw client area in any window redarwing process is actually done in two steps. First your window is sent WM_ERASEBKGND message and all client area is erased and painted by your window background brush( this is one of the members in WNDCLASS structure). Then your drawing is perforemed by sending WM_PAIN message to your window. It is drawing your background what causes filckering. So there are two ways to avoid it. First, you can resiter your window with NULL brush, and second you can handle WM_ERASEBKGND return TRUE without any background erasing

BOOL CYourWindow::OnEraseBkgnd(CDC *pDC)
{
return TRUE;
}

If you need to prevent erase only in special cases you can add boolean member to your class which you can check in OnEraseBkgnd and perform or not perform background erasing.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

810 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