Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

FLicker problem.

Posted on 2004-04-16
4
Medium Priority
?
591 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
ID: 10840512
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 2000 total points
ID: 10840546
Override OnEraseBkgnd in View class and return TRUE without calling of base class function.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 10840555
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
ID: 10840662
Overiding EraseBkGnd works....
Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 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