title: Graphics.Clear on a Windows Form Control also clears the control itself - how to prevent this?
body: <p>I try to draw a custom selection rectangle on a Picturebox, using the method below:</p>
  
  <pre><code>    void _drag_UpdateView(bool clearOnly, MouseEventArgs e)
      {
          System.Diagnostics.Debug.WriteLine("UpdateView");
          using (Graphics g = this.i_rendered.CreateGraphics())
          {
              g.Clear(Color.Transparent);
              if (clearOnly)
                  return;
              int px = (_drag_start.X &gt; e.Location.X)?e.Location.X:_drag_start.X;
              int py = (_drag_start.Y &gt; e.Location.Y)?e.Location.Y:_drag_start.Y;
              if (px &lt; 0)
                  px = 0;
              if (py &lt; 0)
                  py = 0;
              int wx = Math.Abs(e.Location.X-_drag_start.X);
              int wy = Math.Abs(e.Location.Y-_drag_start.Y);
              g.DrawRectangle(Pens.LightBlue, px, py, wx, wy);
          }
      }
  </code></pre>
  
  <p>Whenever I call:</p>
  
  <pre><code>g.Clear(Color.Transparent);
  </code></pre>
  
  <p>the whole picturebox turns black. However, the rectangle gets drawn over it.
  If I do not call that method, the rectangles stack on itself, of course. I want to remove the old rectangle and create a new one like this.</p>
  
  <p>Can anyone describe what's wrong?</p>