Solved

folloup to color question

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 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

13 Experts available now in Live!

Get 1:1 Help Now