Solved

Using BitBlt() Function !!

Posted on 2002-04-20
1
592 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
1 Comment
 

Accepted Solution

by:
muneeb_baig earned 100 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
zeroFront challenge 7 114
matchUp  challenge 9 115
changeXy challenge 13 89
I could not set window to top 4 21
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

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