title: While used Thread.Sleep with pictureBox, Winform freezes
body: <p>I am working for a project where pictureBox used to show images from a directory one by one.</p>
  
  <p>First I click start button. It calls a backgroundWorker which continuously run until I press stop button. Then inside backgroundWorker I called a timer with 500ms time interval. It calls a eventhandler method.</p>
  
  <p>Inside evenhandler method first  I am taking the file name from the directory which is numerical and show in a pictureBox named "PicBox" and increment and then show the next image. I used a while loop that run whole process until I click stop button.</p>
  
  <p>The problem is it starts after 500ms(timers interval) and shows all pictures in a high speed. I want to show them in a flow so that user can't realize that all is a combination of several images, but not at this speed.</p>
  
  <p>I used Thread.Sleep() but it freezes the winform and I can't even click stop button.</p>
  
  <p><strong>PictureBox</strong> code is here:</p>
  
  <pre><code>if (_performReceiving)
  {
      try
      {
          while (_performReceiving)
          {
              switch (firstNum)
              {
                  case 0:
                  case 1:
                  case 2:
                  case 3:
                  case 4:
                  case 5:
                  case 6:
                  case 7:
                  case 8:
                  case 9:
                      PicBox.Image = Image.FromFile(path + "0" + firstNum + ".png");
                      this.PicBox.SizeMode = PictureBoxSizeMode.Zoom;
                      PicBox.Refresh();
                      firstNum++;
                      break;
                  default:
                      PicBox.Image = Image.FromFile(path + firstNum + ".png");
                      this.PicBox.SizeMode = PictureBoxSizeMode.Zoom;
                      PicBox.Refresh();
                      firstNum++;
                      break;
              } 
          }
      }
      catch (FileNotFoundException)
      {
          MoveTimer.Stop();
      }
  }
  </code></pre>
  
  <p>Is there any suggestion?</p>
  
  <p><strong>EDIT:</strong>(Visual view of code)</p>
  
  <pre><code>Form class
  {
  start_button clicked()
  {
     //call backgroundWorker1
  }
  
  backgroundWorker1_DoWork()
  {
     //create Timer1_handler
     //Timer1.Start()
  }
  
  Timer1_handler()
  {
     //Process to get firstNames numeric value which passes to switch parameter
  
     :: This code posted on the main question ::
  }
  }
  </code></pre>