I want to make a simple picture slideshow from the stated folder. The label show the full location detail of the image, how can the label show the picture name only?
- int counter = 0;
- private void button1_Click(object sender, EventArgs e)
- {
- timer1.Start(); //start the slideshow
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- counter++;
- string path = @"C:\Users\Tan Wei Shen\Desktop\FYP\Animal";//directory of the picture
- string[] filePaths = Directory.GetFiles(path, "*.jpg ");
- if (counter > filePaths.Length - 1)
- {
- counter = 0; //reset the picture
- }
- pictureBox1.Image = Image.FromFile(filePaths[counter]); //show image
- label1.Text = filePaths[counter]; //show name of the image
- }
Bryian TanPosted Nov 3, 2017, 2:27 AM
Nilesh PatilPosted Nov 2, 2017, 12:57 AM
Bryian TanPosted Nov 1, 2017, 11:08 PM