# Visual Studio 2008 and MFC Feature Pack



## Roxoff (Jun 9, 2008)

Hi there

We (i.e. me and my colleagues at work) have come across a very odd problem with the latest MFC feature pack and the latest Microsoft IDE, and wondered if anyone else had seen this and even could suggest a work around.

We had a redraw problem with OnPaint and OnDraw of our document class. the problem was that if any part of the view was invalidated, it would cause the whole view panel to be redrawn - problem is our application can have huge documents and take a few seconds to redraw, and this was happening even if the user popped an about box or a file save box over the view, which would then hang for several seconds doing a redraw of the view with the same image that was already there.

After spending far too long investigating this phenomenon, we tried to reproduce this with an app-wizard generated MDI project. None of our existing code in there, just a loop in OnDraw that dropped ellipses over one another, enough to tie up the draw process for a second or so and that would be visible to the naked eye. All we had to do was do a 'file->open' to pop the standard file dialog and watch the redraw around the outside of its box. And it turned up.

This never used to happen with earlier versions of MFC - if you popped a dialog over your view, it never needed to invalidate the whole view and cause a re-draw. It just drew the dialog box.

Some deeper investigation showed that bypassing the PaintDC/MFC overhead in the OnPaint handler and using ::BeginPaint(...), the invalid rectangle for the CView-derived panel equated to the whole client area, and there should have been no change to any of that. This just wasn't the case for earlier versions of MFC which allowed small sections of the view to be redrawn as needed.

Has anyone else seen this effect? Can anyone help with a workaround?


----------

