Solved

FLicker problem.

Posted on 2004-04-16
4
556 Views
Last Modified: 2013-11-20
Hi,

   I am updating a HBITMAP's DIBSection at 15 times a scond. The resolution is 1280 by 1024. When I display this DIBSection on the View in the Document/view architecture, it flickers like crazy. What could be the problem?

The HBITMAP's DIBSection is stored in the Document and the image bits in the DIBsection are copied over 15 times a second. And the view does a StretchBlt to screen at OnDraw.

Regards,
Cedric.
0
Comment
Question by:pcssecure
  • 2
4 Comments
 
LVL 4

Expert Comment

by:caner_elci
Comment Utility
Are you doing double buffering?
If not, try double-buffering.. Create another HBITMAP that has the same properties with your main HBITMAP.. then do your drawing and stuff offscreen, using that HBITMAP.. then BitBlt() it to your DC.. and continues this way.. always use offscreen drawing and just bitblt..

And take a look at this sample : http://www.codeproject.com/gdi/flickerfree.asp
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
Comment Utility
Override OnEraseBkgnd in View class and return TRUE without calling of base class function.
0
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
If your image doesn't fill all view client area, fill it in OnDraw using your own code, because after overriding if OnEraseBkgnd there is no more white view background supplied by this function.

The reason of flickering: every time you invalidate view client area, it is drawin by OnEraseBkgnd in white color, and immidiately after this OnDraw draws the image.
0
 

Author Comment

by:pcssecure
Comment Utility
Overiding EraseBkGnd works....
Thanks.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mac OS 9 (Classic Environment) vs. MacBook Pro OS 10 8 36
notReplace  challenge 53 102
MaxSpan challenge 9 65
Path of Workbook 3 44
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

8 Experts available now in Live!

Get 1:1 Help Now