C# Exercises

Home AgriMetSoft About Contact

How to Show an Image Slider in Windows Form Application | C#

	
namespace SlideShow_PictureBox
{
  public partial class Form1 : Form
  {
    int imgNum = 1;
    FolderBrowserDialog fbd;
    public Form1()
    {
      InitializeComponent();
      pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
    }

    private void start_Click(object sender, EventArgs e)
    {
      fbd = new FolderBrowserDialog();
      fbd.ShowDialog();
      timer1.Enabled = true;
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
      pictureBox1.ImageLocation = string.Format(fbd.SelectedPath + "\\img{0}.jpg", imgNum);
      imgNum++;
      if (imgNum == 3)
        imgNum = 1;
    }   
  }
}
	


Download the project of Visual Studio 2013 in DropBox Download


C# SlideShow Images by using PictureBox | Show Image Slider in Winform


List of Exercises