title: Override paint method C#
body: <p>I have two forms Form 1 and Form 2.</p>
  
  <p>Form 2 is inheriting from Form 1. In Form 1 I have a method on_Paint for a particular panel, in which I am drawing an image. Since Form 2 is inheriting from Form 1, the panel is being shown as painted before I even run the program (on the design of Form 2).</p>
  
  <p>The problem is, that now I need to paint some things over this image after the image is painted in Form 2. How can I make this possible?</p>
  
  <p>This is some code to make the problem more clear.</p>
  
  <p>// This is Form 1 on_Paint method</p>
  
  <pre><code>private void grid_Paint(object sender, PaintEventArgs e)
  {
      Image img = Image.FromFile(resourcesPath+ "grid.fw.png");
  
      gridGraphics = grid.CreateGraphics(); 
      gridGraphics.DrawImage(img, 0, 0, 650, 550);
  }
  </code></pre>
  
  <p>// This is the method which I want to be invoked after the grid is painted.. This is located in Form 1:</p>
  
  <pre><code>public void paintSprites(int row, int column, int value)
  {
       int yLoc = 0;
       int xLoc = 0;
       Graphics g = grid.CreateGraphics();
  
       switch (row)
       {
           case 0: yLoc = 435; break;
           case 1: yLoc = 355; break;
           case 2: yLoc = 275; break;
           case 3: yLoc = 195; break;
           case 4: yLoc = 115; break;
           case 5: yLoc = 35; break;
       }
  
       switch (column)
       {
           case 0: xLoc = 35; break;
           case 1: xLoc = 120; break;
           case 2: xLoc = 205; break;
           case 3: xLoc = 290; break;
           case 4: xLoc = 375; break;
           case 5: xLoc = 460; break;
           case 6: xLoc = 545; break;
       }
  
       if (value == 1)
       {
           g.DrawImage(red, xLoc, yLoc, 65, 65);
       }
       else g.DrawImage(gold, xLoc, yLoc, 65, 65);
   }
  </code></pre>
  
  <p>This method is located in Form 2 and calls the method above:</p>
  
  <pre><code>public void checkWhichToPaint()
  {
      for (int i = 0; i &lt; ROWS; i++)
      {
          for (int j = 0; j &lt; COLUMNS; j++)
          {
              if (gridMap[i, j] != 0)
              {
                  paintSprites(i, j, gridMap[i, j]);
              }
          }
      }
  }
  </code></pre>
  
  <p>and I am calling the method checkWhichToPaint() after creating a new instance of Form 2 and Showing it:</p>
  
  <pre><code>Tournament tournament = new Tournament();
  tournament.LoadGame();
  tournament.Show();  
  tournament.checkWhichToPaint();
  </code></pre>
  
  <p>where can I call this method such as it is painted after the grid_Paint is invoked? </p>
  
  <p>Thanks for your help :)</p>