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();
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- counter++;
- string path = @"C:\Users\Tan Wei Shen\Desktop\FYP\Animal";
- string[] filePaths = Directory.GetFiles(path, "*.jpg ");
- if (counter > filePaths.Length - 1)
- {
- counter = 0;
- }
- pictureBox1.Image = Image.FromFile(filePaths[counter]);
- label1.Text = filePaths[counter];
- }