Solved

VC++ : Turning off Background Erase

Posted on 1997-11-22
1
337 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 100 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

770 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