Solved

FLicker problem.

Posted on 2004-04-16
4
573 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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: 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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

627 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