title: Winforms Frameratelock in OnPaint?
body: <p>I'm currently trying to polish my application and improve it's performance.
  Basically, it's an advanced Graph- class. It draws a few lines and refreshes them.</p>
  
  <p>After fixing a few slow points, I wanted to benchmark my result.
  My drawing was stuck at ~65 FPS (which is perfect but I'm benchmarking).
  I Invalidate my object in a timer (set to 1 ms) and redraw my stuff using the protected override void OnPaint -"way".</p>
  
  <p>After that, I put the Invalidate() into the protected override void OnPaint. The FPS was set to a few thousand afterwards. But using that method will result in an empty screen.</p>
  
  <p>My question is: Is that issue done on purpose? That would make sense as anything higher than your screen refreshrate is wasted power. But I'd like to disable that "lock" for my benchmarking.</p>
  
  <p>Sample code:</p>
  
  <pre><code>//Timer to refresh
  private void timer1_Tick(object sender, EventArgs e)
      {
          Invalidate();
      }
  
  private DateTime date = DateTime.UtcNow;
      private long times = 0;
      protected override void OnPaint(PaintEventArgs e)
      {
  
          base.OnPaint(e);
  
          //Drawing
          e.Graphics.DrawLine(new Pen(Brushes.Black), 50, 50, Width - 100, Height - 100);
  
          //Required to tell me the framerate
          if ((DateTime.UtcNow - date).Seconds &gt; 1)
          {
              date = DateTime.UtcNow;
              Debug.WriteLine(times);
              times = 0;
          }
  
          times++;
      }
  </code></pre>
  
  <p>Thanks</p>
  
  <p>~Steve</p>