CView::OnUpdate without flicker 
Author Message
 CView::OnUpdate without flicker

How do I Update the CView without flickering? I get the region that need to be
repainted with CFrameWnd::GetInvalidRgn(), but it always contain only one
rectangle, which is covering the whole clientarea. How come, that though I do not
use the CS_VREDRAW and CS_HREDRAW flags in the call to AfxRegisterWndClass(), the
whole clientarea is invalidated in case of for example resizing? This makes my
repainting function extremly ineffective, and it causes heavy flickering.


Wed, 20 Aug 2003 20:33:57 GMT  
 CView::OnUpdate without flicker

Quote:

> How do I Update the CView without flickering? I get the region that need to be
> repainted with CFrameWnd::GetInvalidRgn(), but it always contain only one
> rectangle, which is covering the whole clientarea. How come, that though I do not
> use the CS_VREDRAW and CS_HREDRAW flags in the call to AfxRegisterWndClass(), the
> whole clientarea is invalidated in case of for example resizing? This makes my
> repainting function extremly ineffective, and it causes heavy flickering.

The view is not the same window as the CFrameWnd.  For the invalid region of a
CView use pDC->GetClipBox in the view OnDraw.  

To fix flicker handle the WM_ERASEBGND message and do nothing in it.  This
eliminates the default erase of the whole thing just before WM_PAINT.  Then in
WM_PAINT (CView::OnDraw) use the technique illustrated in the
CDC::CreateCompatibleDC documentation.  This lets you erase and draw to an
offscreen buffer and then blit the whole thing as a bitmap in one shot, which
looks really good.

--
Scott McPhillips [VC++ MVP]



Wed, 20 Aug 2003 21:38:12 GMT  
 CView::OnUpdate without flicker

pDC-GetClipBox() returns a RECT-structure and not a region. When the user
increases the width and height of the window by one pixel, the GetClipBox
would return the whole window in the RECT structure, because that is the
smallest rectangle that encloses the invalid pixels.

I already handle the WM_ERASEBGND and do nothing, but that does not solve
the problem, because I still have to blit a single bitmap almost as big as
the screen every time the user drags in the border of the window.

"Scott McPhillips" wrote

Quote:
> > How do I Update the CView without flickering? I get the region that need
to be
> > repainted with CFrameWnd::GetInvalidRgn(), but it always contain only
one
> > rectangle, which is covering the whole clientarea. How come, that though
I do not
> > use the CS_VREDRAW and CS_HREDRAW flags in the call to

AfxRegisterWndClass(), the
Quote:
> > whole clientarea is invalidated in case of for example resizing? This
makes my
> > repainting function extremly ineffective, and it causes heavy
flickering.

> The view is not the same window as the CFrameWnd.  For the invalid region
of a
> CView use pDC->GetClipBox in the view OnDraw.

> To fix flicker handle the WM_ERASEBGND message and do nothing in it.  This
> eliminates the default erase of the whole thing just before WM_PAINT.
Then in
> WM_PAINT (CView::OnDraw) use the technique illustrated in the
> CDC::CreateCompatibleDC documentation.  This lets you erase and draw to an
> offscreen buffer and then blit the whole thing as a bitmap in one shot,
which
> looks really good.

> --
> Scott McPhillips [VC++ MVP]



Fri, 22 Aug 2003 04:23:10 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. What message call CView::OnUpdate

2. Keeping the CView from flickering?

3. Flickering CView

4. Drawing without Flicker

5. Docking windows without flickering

6. moving a button without flickering.

7. Displaying bitmap using bitblt/stretchblt without flicker effect

8. Redraw without flickering / waveform display / realtime hints

9. How to move line without flickering(which is attached to child window)

10. how to move the line(which is attached to child window) without flickering

11. Terminate doc-view application without showing a flicker.

12. Use of CView without document-view architecture

 

 
Powered by phpBB® Forum Software