Re: Flickering

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jerry Coffin (jcoffin_at_taeus.us)
Date: 05/23/04


Date: Sun, 23 May 2004 08:04:44 -0600

In article <uY0ihqMQEHA.2404@TK2MSFTNGP12.phx.gbl>, janiv@aoe6.net
says...
> Hi,
> I M drawing a wallpaper on my CView class, I have to redraw it every time
> the user click on that view.

Why do you have to redraw it every time the user clicks on the view?
You normally only have to redraw things if they've been obscured, or
the view changes.

> Because of that any time the user click on the
> View the wallpaper is redrawn and flickers.
> Why? How do I prevent that ?

The most common cause of flicker in a situation like this is allowing
the background to be erased normally before drawing your bitmap.
Since your bitmap is apparently (more or less) a background, you
probably want to draw it in response to WM_ERASEBKGND.

-- 
    Later,
    Jerry.
The universe is a figment of its own imagination.


Relevant Pages

  • Re: Drawing continuously(dynamically) in MFC .
    ... I don't see why drawing your screen from OnPaint or OnDraw has the effect you describe. ... Why would the application hang? ... you need to have EVERYTHING necessary to COMPLETELY redraw the ...
    (microsoft.public.vc.mfc)
  • When do I redraw?
    ... I'm writing something that does some drawing on a picturebox. ... events fired to let me know that I need to redraw. ... private void button1_Click ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Tutorial on Proper Animation
    ... I haven't used it yet, but my understanding is that WPF in .NET 3.0 provides a good, high-level animation API that should allow you to not need to worry about those kinds of specifics. ... If you want to do the animation explicitly in .NET without WPF, I think you may find that the simplest method of maintaining an off-screen Bitmap into which you do all your drawing and which is then copied to the screen may work best. ... However -- and I realize this seems a little counter-intuitive -- my experience has been that your time is better spent ensuring that you can redraw _everything_ each frame while maintaining sufficient performance, and then don't worry about minimizing what you redraw. ... The reason being that changes in frame rate can be just as problematic as low frame rate, and so if your code only performs well when it doesn't have a lot of work to do, it will bog down noticeably during those moments when a lot of things are changing at once. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C#) How to keep drawing graphics by GDI
    ... Most Windows applications do just that: keep all the drawing data. ... In many cases, they are dealing with a very complex document, whether text or graphics or some more abstract data that is reprented on-screen by text or graphics. ... Every time the window needs to be redrawn, they go through all the relevant data and redraw it. ... And even in that case, the data required to draw everything from scratch is generally maintained in memory; the caching is with respect to the execution of the drawing commands, rather than throwing out the source data altogether. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Transparency Revisited...
    ... object oriented drawing program. ... I've got shape objects that draw themselves. ... needed to redraw all the object even as the mouse was moving while drawing - ... But redrawing the background grid was giving flicker because, ...
    (microsoft.public.dotnet.languages.vb)