title: WinForms paint cycle documentation?
body: <p>Is there documentation on the paint cycle in WinForms?</p>
  
  <p>When i am programming in Windows the paint cycle is usually of the form:</p>
  
  <pre><code>sent a WM_PAINT message
  {
     call BeginPaint(&amp;paintStruct)
  
        //BeginPaint sends WM_NCPAINT and WM_ERASEBKGND
        sent a WM_ERASEBKGND message
        {
           i can:
             - allow default processing (Windows will fill the area with the default background color (e.g. white)
             - erase and background myself (e.g. a gradient) and prevent default processing
             - do nothing (letting whatever was there before me stay there) and prevent default processing
        }
  
     perform whatever painting i desire on 
           paintStruct.hDC (Device Context)
           paintStruct.rcPaint (Invalid Rectangle)
     that was populated into paintStruct during BeginPaint
  
     call EndPaint()
  }
  </code></pre>
  
  <p>This is all documented on MSDN: <a href="http://msdn.microsoft.com/en-us/library/dd183315%28v=VS.85%29.aspx" rel="nofollow">Windows Development\Graphics and Multimedia\Windows GDI\Painting and Drawing\About Painting and Drawing</a></p>
  
  <p>i cannot find any such documentation about WinForms and its paint cycle. i can randomly find methods and events that have the name <em>paint</em> in them:</p>
  
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onpaint.aspx" rel="nofollow"><code>OnPaint</code></a> (protected method "Raises the Paint event.")</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onprint.aspx" rel="nofollow"><code>OnPrint</code></a> (protected method "Raises the Paint event.")</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.invokepaint.aspx" rel="nofollow">InvokePaint</a> (protected method "Raises the Paint event for the specified control.")</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.paint.aspx" rel="nofollow"><code>Paint</code></a> (public event)</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.invokepaintbackground.aspx" rel="nofollow"><code>InvokePaintBackground</code></a> (protected method "Raises the PaintBackground event for the specified control.")</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onpaintbackground.aspx" rel="nofollow"><code>OnPaintBackground</code></a> (protected method "Paints the background of the control.")</li>
  </ul>
  
  <blockquote>
    <p><strong>Note</strong>: Ignoring the fact that there is no <code>PaintBackground</code> event</p>
  </blockquote>
  
  <p>Is there documentation describing the design relationship between these entities? Is there documentation on the paint cycle in WinForms?</p>