image slideshow
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { timer1.Interval = 5000; timer1.Enabled = true; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { for (int i = 0; i < 5 ; i++) { pictureBox1.Image = imageList1.Images[i]; } } } } ************************ every time i run this application only the last image from the image list is displayed. I need to display all d images with 5 seconds delay between each of them !!! plz help needed !!! where am i goin wrong >?????????????
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { timer1.Interval = 5000; timer1.Enabled = true; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { for (int i = 0; i < 5 ; i++) { pictureBox1.Image = imageList1.Images[i]; } } } } ************************ every time i run this application only the last image from the image list is displayed. I need to display all d images with 5 seconds delay between each of them !!! plz help needed !!! where am i goin wrong >?????????????
your problem is in your tick event handler. you are looping all the images at once. to solve your problem you need to create a Global index for the image currently being displayed then increment that with every tick and display the appropriate image. Do you understand?
Life goes very fast. Tomorrow, today is already yesterday.
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { timer1.Interval = 5000; timer1.Enabled = true; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { for (int i = 0; i < 5 ; i++) { pictureBox1.Image = imageList1.Images[i]; } } } } ************************ every time i run this application only the last image from the image list is displayed. I need to display all d images with 5 seconds delay between each of them !!! plz help needed !!! where am i goin wrong >?????????????
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { //Variables int currentimageindex = 1; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { timer1.Interval = 5000; timer1.Enabled = true; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { if(currentimageindex <= 5) { pictureBox1.Image = imageList1.Images[currentimageindex]; currentimageindex++; } else { currentimageindex = 1; } } } } }
-
your problem is in your tick event handler. you are looping all the images at once. to solve your problem you need to create a Global index for the image currently being displayed then increment that with every tick and display the appropriate image. Do you understand?
Life goes very fast. Tomorrow, today is already yesterday.
thanks a lot it worked !!!