You may see painting issues with MFC MDI Office Style Applications when resizing or moving the window around as shown below

image

 

This bug is caused by different values returned by GetSystemMetrics() under VS 2010 and VS 2012 (the issue was discussed here: https://connect.microsoft.com/VisualStudio/feedback/details/753224/regression-getsystemmetrics-delivers-different-values .

If you are hit by the issue, it can be resolved in application by adding WM_NCCALCSIZE message handlers to CMainFrame and CChildFrame classes:

void CMainFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp)

{

CMDIFrameWndEx::OnNcCalcSize(bCalcValidRects, lpncsp);

if (!afxGlobalData.IsDwmCompositionEnabled() && CMFCVisualManager::GetInstance()->IsOwnerDrawCaption())

       {

int cxPaddedBorder = GetSystemMetrics(SM_CXPADDEDBORDER);

if (cxPaddedBorder != 0)

              {

lpncsp->rgrc[0].top -= cxPaddedBorder;

lpncsp->rgrc[0].bottom += cxPaddedBorder;

              }

       }

}

void CChildFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp)

{

CMDIChildWndEx::OnNcCalcSize(bCalcValidRects, lpncsp);

if (!afxGlobalData.IsDwmCompositionEnabled() && CMFCVisualManager::GetInstance()->IsOwnerDrawCaption())

       {

int cxPaddedBorder = GetSystemMetrics(SM_CXPADDEDBORDER);

if (cxPaddedBorder != 0)

              {

lpncsp->rgrc[0].top -= cxPaddedBorder;

              }

       }

}