title: Draw rectangle where mouse clicked
body: <p>I'm very new in C#
  I want a rectangle to appear wherever there's a     mouseclick on a panel</p>
  
  <p>Here's my code:</p>
  
  <pre><code>private void panel1_MouseClick(object sender, MouseEventArgs e)
  {
    int x = e.Location.X;
    int y = e.Location.Y;
  
         if (radioButton1.Checked == false)
         {
  
                  ((Panel)sender).Invalidate(new Rectangle(x * 40, y * 40, 40, 40));
         }
         else if (radioButton2.Checked == true)
         {
                  return;
         }
  }
  </code></pre>
  
  <p>I wonder how to change the color of the rectangle?
  Please advise me if my code is wrong.
  Thanks.</p>