Solved

Using BitBlt() Function !!

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mixString challenge 36 122
viewing source code from eclipse 13 107
move a line in eclipse 3 103
Making an alias 7 95
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…
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 Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

777 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