title: Winforms Drawing - Parameter is not valid on system resume
body: <p>I have an odd problem when my app is running and the system resumes from hibernation (in Windows 7).</p>
  
  <p>I am calling the Graphics.DrawString method and this works fine most of the time. Except when the program is running and I hibernate the system. Then when I resume, the DrawString method throws an ArgumentException (Parameter is not valid) and gives me a red cross where my drawing should be.</p>
  
  <p>What is going wrong here? Catching the exception avoids the red cross but when we get into this state there is no way back and the exception will keep being thrown until the program is restarted.</p>
  
  <p>Thanks for any help,
  Alan</p>
  
  <p><strong>Edit: Here is the code that is failing:</strong></p>
  
  <pre><code>protected override void OnPaint(PaintEventArgs e)
  {
      // Drawing logic succeeds until this point
  
      e.Graphics.DrawString(Text, Font, new SolidBrush(ForeColor), new PointF(x, y));
  }
  </code></pre>
  
  <p>This is actually a subclass of ToolStripLabel.</p>