title: How can I make refreshing a control faster?
body: <p>I have a custom control in C#.  I have noticed that calling <code>Refresh</code> is much slower than I would like (about 0.1ms), even when I have an empty <code>RePaint</code> function.  Basically, my application processes a grid and, one by one, it refreshes each grid cell.  This rather inefficient behavior is by design; when enabled I want to be able to actually see what each step of processing has done, and each step only ends up changing one cell.  Toggling double-buffering does not make much difference.</p>
  
  <p>Can anyone offer any advice?</p>
  
  <p>Currently, the best improvement I've come up with is to replace my call to <code>Refresh</code> with a call to <code>Refresh2</code>.  The latter function is an exact copy of <code>Repaint</code>, except for two lines added to the top, <code>Graphics g = Graphics.FromHwnd(this.Handle); g.Clear(BackColor);</code> and replacing <code>e.Graphics</code> with <code>g</code>.  I am suspicious that there is some disadvantage to this, but it does cut the drawing speed in half.  Take note that the control I am working with has no subcomponents, so things like validation don't have quite as much concern.</p>