Resizing docked pane in STOCK Visual Studio 2012 M

2019-08-17 08:19发布

问题:

I support several Visual Studio 2012 MFC applications, and all of them are exhibiting the same bad behavior on Windows 10 only: resizing a docked pane (via mouse) leaves artifacts, i.e. garbage on the screen. The garbage looks like a series of lines that correspond to the intermediate positions of the pane edge being dragged. I can reproduce this behavior with a stock VS 2012 application, which proves that it's got nothing to do with my code. Here are simple instructions for replicating the bug.

In the VS 2012 New Project Wizard, select MFC Application and press OK. Accept the defaults for all options EXCEPT ONE: On the very last page (Generated Classes), change the Base class from CView to CScrollView. Then press Finish.

Now make the following edit. Find the line "// TODO: calculate the total size of this view" in OnInitialUpdate, in the view .cpp file. Change the size from 100 to 2000. The only purpose of this change is to ensure that the view has scrollbars.

Now run the resulting app under Windows 10. Try resizing the docked panes. Do you see the artifacts? They generally appear when the scroll view is getting BIGGER. Why is this happening? Would migrating to VS 2017 solve it? Or is Windows 10 now incompatible with MFC? Ever since I migrated to the "new" MFC (BCGSoft) features, I've been worried that their code is too complex and would break in some future release of Windows. It sure looks as if I was right to fear this.