Solved

folloup to color question

Posted on 1998-06-09
2
177 Views
Last Modified: 2013-11-20
I changed the background in my view in the OnPrepareDC function.This is the code I use:
CBrush Br(RGB(0,0,0));
CRect rcBounds;
 pDC->GetClipBox(&rcBounds);
 CBrush* pOldBrush = pDC->SelectObject(&Br);
 pDC->PatBlt(rcBounds.left, rcBounds.top, rcBounds.Width(), rcBounds.Height(),PATCOPY);
 pDC->SelectObject(pOldBrush);
COLORREF crBk = pDC->GetBkColor();
pDC->SetBkColor(RGB(0,0,0));
COLORREF crTxt = pDC->GetTextColor();
pDC->SetTextColor(RGB(255,0,0));

The problem is when I scroll, I see white flashes come across the screen, as if the view is being redrawn in white, before being drawn as black. Any idea what this may be? Where is it being drawn in white?

Thanks
0
Comment
Question by:smithc
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1317806
The answer to that is WM_ERASEBACKGND and your class has a default brush. Your best bet is to use a memory DC to do your drawing and to then make the copy to the screen. This elminates all flashes.
0
 

Author Comment

by:smithc
ID: 1317807
thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 163
sumDigits challenge 9 170
viewing source code from eclipse 13 110
Problem to event 3 102
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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