title: Simple panel-slider in C#
body: <p>I'm currently developing a C# application. Right now I'm trying to realize a simple slider: </p>
  
  <pre><code>|--------------------------|
  |                          |
  |  |--------------------|  |
  |  |                    |  |
  |  |       Panel1       |  |
  |  |       Panel2       |  |
  |  |                    |  |
  |  |--------------------|  |
  |           x x x          |
  |--------------------------|
  </code></pre>
  
  <p>I have two panels with exactly the same size. Panel1 is just needed for displaying a border and setting the boundaries for panel2 which is then dynamically exchanged. </p>
  
  <p>If the second x is clicked, panel2 should move to the left and panel3 should come from the right and also move to the left.</p>
  
  <p>Basically I have the following code:</p>
  
  <pre><code>Panel panel2 = panelArray[0];
  Panel panel3 = panelArray[1];
  </code></pre>
  
  <p>The following code should now perform the slide:</p>
  
  <pre><code>for (int i = 0; i &lt;= 100; i++)
  {
      panel2.Location = new Point(panel2.Location.X - i, panel2.Location.Y);
      System.Threading.Thread.Sleep(10);
  }
  
  for (int i = 0; i &lt;= 100; i++)
  {
      panel3.Location = new Point(100 - i, panel3.Location.Y);
      System.Threading.Thread.Sleep(10);
  }
  </code></pre>
  
  <p>Somehow the first panel is slided-out perfectly but panel2 is not sliding. It's just displayed after the loop is executed. </p>
  
  <p>Any idea why panel2 isn't performing the slide? I'm using WinForms.</p>