title: Proper way to add delay in my code execution
body: <p>I am trying to make a very simple logic game. The idea is to see a matrix with a certain number of colored squares(buttons) then to hide them and the player has to click the colored squares. So I need a 2 second delay between the painting the squares/buttons and returning the original colors. All the code is implemented in a <code>button_click</code> event.</p>
  
  <pre><code>private void button10_Click(object sender, EventArgs e)
  {
  
      int[,] tempMatrix = new int[3, 3];
      tempMatrix = MakeMatrix();
      tempMatrix = SetDifferentValues(tempMatrix);
      SetButtonColor(tempMatrix, 8);
      if (true)
      {
          Thread.Sleep(1000);
         // ReturnButtonsDefaultColor();
      }
      ReturnButtonsDefaultColor();
      Thread.Sleep(2000);
  
      tempMatrix = ResetTempMatrix(tempMatrix);
  }
  </code></pre>
  
  <p>This is the whole code, but what I need is to have some delay between calling <code>SetButtonColor()</code> and <code>ReturnButtonsDefaultColor()</code>. All my experiments with <code>Thread.Sleep()</code> meet no success till now. I get a delay at some point, but the colored squares/buttons are never shown.</p>