title: Artifacts in surface of MFC application
body: <p>I had to visually improve an old MFC application which worked fine in the old layout.
  Now with the new layout artifacts (highlighted in the picture below) can occur if another window is moved in the foreground of this application.<br>
  Even if my application gets back the focus it does not repaint properly.</p>
  
  <p>The main windows is a <code>CFrameWnd</code> with style <code>WS_OVERLAPPEDWINDOW</code> and contains other elements like <code>CWnd</code> and <code>CDialogBar</code>.<BR>I had to override the default behavior at some point (<code>OnNcPaint</code>, <code>OnActivate</code>, <code>OnPaint</code>) to achieve the specifications.</p>
  
  <p>If I switch back to the ugly old layout, the drawing is faultless. But there are so many parts changed that I couldn't find the one difference that causes this issue. Hopefully you can name a possible reason.</p>
  
  <p>I'm glad to assist you with more specific information if needed. </p>
  
  <p><img src="https://i.stack.imgur.com/kmVCK.jpg" alt="Artifacts"></p>