Image slideshow
I need help making 3 picture boxes display 3 different images every 3 seconds
2 Replies
Either custom control or use a timer to change between the controls
is this code correct?
using System.Media;
namespace WinFormsApp3
{
public partial class Form1 : Form
{
private Bitmap[] images;
private int currentImageIndex;
SoundPlayer soundPlayer;
public Form1()
{
InitializeComponent();
soundPlayer = new SoundPlayer(Properties.Resources.awesomeness);
soundPlayer.PlayLooping();
Bitmap cat1 = new Bitmap(Properties.Resources.cat);
Bitmap cat2 = new Bitmap(Properties.Resources.cat2);
images = new Bitmap[] { cat1, cat2 };
currentImageIndex = 0;
}
private void timer1_Tick(object sender, EventArgs e)
{
currentImageIndex++;
if (currentImageIndex >= images.Length)
{
currentImageIndex = 0;
}
pictureBox1.Image = images[currentImageIndex];
}
private void button1_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2(soundPlayer);
form2.Show();
}
}
}
mane i give up
cant get ts to work