?
Solved

Using BitBlt() Function !!

Posted on 2002-04-20
1
Medium Priority
?
595 Views
Last Modified: 2013-11-20
Hello Experts !!

I developed an SDI application which displays a Bitmap !! I call UpdateAllViews(NULL) very frequently when a MOUSE_MOVE message is sent. The problem is that the bitmap flickers a lot. I wanna reduce or simple avoid flickering, which is why I'm using BitBlt() function. but still It seems to flicker.

This is the code I've written;

CPaintDC dc(this);
CDC memDC;
memDC.CreateCompatibleDC(&dc);

CBitmap bm;
bm.LoadBitmap(IDB_BITMAP1);

memDC.SelectObject(bm);
CRect rc;
GetClientRect(&rc);
OnDraw(&dc);
dc.BitBlt(0,0,rc.Width(), rc.Height(), &memDC,0,0,BLACKNESS);

Can somebody tell me why this does not work as expected.

--Din--
0
Comment
Question by:dineth
[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
 

Accepted Solution

by:
muneeb_baig earned 300 total points
ID: 6957396
Don't call UpdateAllViews into Mouse Move event, and also don't try to redraw all bitmap into Mouse move event.  

If you are doing editing into mouse move, then set the writting style to R2_NOT by calling funtion SetROP2.  

e.g if you are drawing a rectangle, then on each mouse move you erase the previous ractangle and create a new one.  
This way there will be no flicker at all.  

I think you got my point.
0

Featured Post

Technology Partners: 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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

741 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