Solved

VC++ : Turning off Background Erase

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now