Solved

folloup to color question

Posted on 1998-06-09
2
173 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

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

23 Experts available now in Live!

Get 1:1 Help Now