Solved

VC++ : Turning off Background Erase

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Find boost header files using gnu make (MinGW) on Win 7 11 78
Quicksort a dynamic deque 33 66
Beginner to Unreal Engine 4 5 57
Why isn't object file created? 6 39
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 clear a vector as well as how to detect empty vectors in C++.

932 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

10 Experts available now in Live!

Get 1:1 Help Now