title: Whys is Graphics.Clear(); Not working in C#
body: <p>I am doing some revision for my comp103 paper and I cant get the button with the Graphics.Clear(); method to clear the graphics paper. Can someone please point out the error in my code as I have spent about an hour trying to find an answer on the net. </p>
  
  <p>Sorry for asking such a noob question.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>namespace Week_4_Ex1
  {
      public partial class Form1 : Form
      {
          const int height1 = 150; // A constant that stores the flags height
          const int width1 = 100; // A constant that stores the flags width
  
          public Form1()
          {
              InitializeComponent();
          }
  
          /// &lt;summary&gt;
          /// Button event that Draws a flag
          /// &lt;/summary&gt;
          /// &lt;param name="sender"&gt;&lt;/param&gt;
          /// &lt;param name="e"&gt;&lt;/param&gt;
          private void btnDraw_Click(object sender, EventArgs e)
          {
              Graphics Paper = this.CreateGraphics(); // Creates graphics paper to draw on
              Brush br1 = new SolidBrush(Color.Blue); // Creates a blue brush to draw with
              Brush br2 = new SolidBrush (Color.Orange); // Creates a orange brush to draw with
              Brush br3 = new SolidBrush (Color.Red); // Creates a red brush to draw with
  
              Pen Pen1 = new Pen(Color.Blue);         // Creates a blue pen to draw with
              Pen Pen2 = new Pen(Color.Orange);       // Creates a orange pen to draw with
              Pen Pen3 = new Pen(Color.Red);          // Creates a red pen to draw with
  
              //The following code draws a flag
              Paper.DrawRectangle(Pen1, 10, 10, width1, height1); // Draws a blue rectangle
              Paper.FillRectangle(br1, 10, 10, width1, height1); // Fills the rectangle with blue
              Paper.DrawRectangle(Pen2, 110, 10, width1, height1); // Draws a blue rectangle
              Paper.FillRectangle(br2, 110, 10, width1, height1); // Fills the rectangle with blue
              Paper.DrawRectangle(Pen3, 210, 10, width1, height1); // Draws a blue rectangle
              Paper.FillRectangle(br3, 210, 10, width1, height1); // Fills the rectangle with blue
  
          }
          /// &lt;summary&gt;
          /// Button that closes the form
          /// &lt;/summary&gt;
          /// &lt;param name="sender"&gt;&lt;/param&gt;
          /// &lt;param name="e"&gt;&lt;/param&gt;
          private void btnExit_Click(object sender, EventArgs e)
          {
              this.Close(); // Closes the form
          }
  
          /// &lt;summary&gt;
          /// Clears the picturebox
          /// &lt;/summary&gt;
          /// &lt;param name="sender"&gt;&lt;/param&gt;
          /// &lt;param name="e"&gt;&lt;/param&gt;
          private void btnErase_Click(object sender, EventArgs e)
          {
              Graphics.Clear(); //**THIS DOESN'T WORK**
          }
  
      }
  }
  </code></pre>
  
  <p>Cheers,
  Rab</p>