Solved

Using BitBlt() Function !!

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

19 Experts available now in Live!

Get 1:1 Help Now