title: How to clear a transparent panel?
body: <p>I made a transparent panel like this (in C#) :</p>
  
  <pre><code>public class TransparentPanel : Panel
  {
      public TransparentPanel()
      {
      }
  
      protected override CreateParams CreateParams
      {
          get
          {
              CreateParams createParams = base.CreateParams;
              createParams.ExStyle |= 0x00000020; // WS_EX_TRANSPARENT
              return createParams;
          }
      }
  
      protected override void OnPaintBackground(PaintEventArgs e)
      {
          // Do not paint background.
      }
  }
  </code></pre>
  
  <p>It is displayed over a normal Panel. I want to draw a circle to show something in the other panel, so I draw my circle on the transparent 's OnPaint method. Then, I want to show something else, so I need this circle to "move" somewhere else.</p>
  
  <p>But I can't.</p>
  
  <p>None of the solutions I could find here worked for me, though I do draw this circle in the OnPaint method.
  I do not use the Graphics object of the event, because if I do, nothing is displayed at all.</p>
  
  <p>So, I have to use this:</p>
  
  <pre><code>this.CreateGraphics()
  </code></pre>
  
  <p>I can't draw another circle over it, using the background color : my background needs to stay transparent. And drawing a circle with Color.Transparent doesn't work.</p>
  
  <p>Clearing the transparent panel results in a black background replacing the transparent one.</p>
  
  <p>The instruction</p>
  
  <pre><code>Graphics.Clear();
  </code></pre>
  
  <p>doesn't compile.</p>
  
  <p>Neither does this one :</p>
  
  <pre><code>gr.Clear();
  </code></pre>
  
  <p>because it needs a Color parameter.</p>
  
  <p>And this:</p>
  
  <pre><code>gr.Clear(Color.transparent);
  </code></pre>
  
  <p>creates a black background.</p>
  
  <p>Seems to me I have tried everything I could think of.</p>
  
  <p>Any idea ?</p>