?
Solved

VC++ : Turning off Background Erase

Posted on 1997-11-22
1
Medium Priority
?
349 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
[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
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

Independent Software Vendors: 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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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…
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

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