title: How to draw a new square every time "DrawObject()" is in the file
body: <p>So I have made a file reader and it reads every line in the file, i have a few commands that it will read and it works but this one wont work
  When the file says "DrawObject()" 
  it should do this:</p>
  
  <pre><code>            if (line.Contains("DrawObject()"))
              {
                  r = new Rectangle();
                  r.Width = 32;
                  r.Height = 32;
                  Invalidate();
              }
  </code></pre>
  
  <p>And it does draw the rectangle because in the paint event I put:</p>
  
  <pre><code>    private void TestScript_Paint(object sender, PaintEventArgs e)
      {
          g = e.Graphics;
          g.Clear(Color.White);
  
          if (dp == true)
          {
              g.FillRectangle(Brushes.Blue, x, y, 32, 32);
          }
  
          g.FillRectangle(Brushes.Blue, r);
  
          DoubleBuffered = true;
      }
  </code></pre>
  
  <p>and it draws the square (g.FillRectangle(Brushes.Blue, r))
  but i want to be able to draw multiple squares
  and every time a square is drawn the player can change the squares X and Y values</p>
  
  <p>These are the X and Y values the player can change in the file:</p>
  
  <pre><code>            if (line.Contains("ObjectX&gt;"))
              {
                  r.X = Convert.ToInt32(line.Substring(9));
              }
  
              if (line.Contains("ObjectY&gt;"))
              {
                  r.Y = Convert.ToInt32(line.Substring(9));
              }
  </code></pre>
  
  <p>EDIT OF CODE:</p>
  
  <pre><code>if (line.Contains("DrawObject()"))
  {
      rectangles.Add(new Rectangle() { Width = 32, Height = 32 } );
      Invalidate();
  }
  
  if (line.Contains("ObjectX&gt;"))
  {
      Rectangle r = rectangles.Last();
      r.X = Convert.ToInt32(line.Substring(9));
      Invalidate();
  }
  
  if (line.Contains("ObjectY&gt;"))
  {
      Rectangle r = rectangles.Last();
      r.Y = Convert.ToInt32(line.Substring(9));
      Invalidate();
  }
  </code></pre>