Scusate sono solo all'inizio vi volevo sottoporvi questo problema, ho creato con photoshop delle immagini i sequenza sono 8 più una fissa di fondo, le immagini le ho inserite nelle pictureBox, ed ho inserito 8 timer ognuno con intervallo diverso come mostrato nel codice, il programma così come realizzato da me funziona (sicuramente si poteva realizzare in altri modi e snellire il codice) ma è giusto per capire il problema in questo caso, quando finisce la sequenza per ripartire aspetta circa qualche secondo, mentre io volevo ripartisse con lo stesso intervallo inserito nei timer.
Praticamente vorrei che queste 8 immagini inserite nelle pictureBox che rappresentano un pallino rosso che gira in un cerchio giallo, girasse sempre senza fermarsi e non come fa attualmente con questo codice.
Questo è il codice in c#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
timer2.Start();
timer3.Start();
timer4.Start();
timer5.Start();
timer6.Start();
timer7.Start();
timer8.Start();
timer9.Start();
}
private void timer2_Tick(object sender, EventArgs e)
{
if (pictureBox2.Visible == true)
{
pictureBox2.Visible = false;
pictureBox3.Visible = true;
pictureBox4.Visible = true;
pictureBox5.Visible = true;
pictureBox6.Visible = true;
pictureBox7.Visible = true;
pictureBox8.Visible = true;
pictureBox9.Visible = true;
}
else if (pictureBox2.Visible == false)
{
pictureBox2.Visible = true;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
}
}
private void timer3_Tick(object sender, EventArgs e)
{
if (pictureBox3.Visible == true)
{
pictureBox2.Visible = true;
pictureBox3.Visible = false;
pictureBox4.Visible = true;
pictureBox5.Visible = true;
pictureBox6.Visible = true;
pictureBox7.Visible = true;
pictureBox8.Visible = true;
pictureBox9.Visible = true;
}
else if (pictureBox3.Visible == false)
{
pictureBox2.Visible = false;
pictureBox3.Visible = true;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
}
}
private void timer4_Tick(object sender, EventArgs e)
{
if (pictureBox4.Visible == true)
{
pictureBox2.Visible = true;
pictureBox3.Visible = true;
pictureBox4.Visible = false;
pictureBox5.Visible = true;
pictureBox6.Visible = true;
pictureBox7.Visible = true;
pictureBox8.Visible = true;
pictureBox9.Visible = true;
}
else if (pictureBox4.Visible == false)
{
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = true;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
}
}
private void timer5_Tick(object sender, EventArgs e)
{
if (pictureBox5.Visible == true)
{
pictureBox2.Visible = true;
pictureBox3.Visible = true;
pictureBox4.Visible = true;
pictureBox5.Visible = false;
pictureBox6.Visible = true;
pictureBox7.Visible = true;
pictureBox8.Visible = true;
pictureBox9.Visible = true;
}
else if (pictureBox5.Visible == false)
{
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = true;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
}
}
private void timer6_Tick(object sender, EventArgs e)
{
if (pictureBox6.Visible == true)
{
pictureBox2.Visible = true;
pictureBox3.Visible = true;
pictureBox4.Visible = true;
pictureBox5.Visible = true;
pictureBox6.Visible = false;
pictureBox7.Visible = true;
pictureBox8.Visible = true;
pictureBox9.Visible = true;
}
else if (pictureBox6.Visible == false)
{
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = true;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
}
}
private void timer7_Tick(object sender, EventArgs e)
{
if (pictureBox7.Visible == true)
{
pictureBox2.Visible = true;
pictureBox3.Visible = true;
pictureBox4.Visible = true;
pictureBox5.Visible = true;
pictureBox6.Visible = true;
pictureBox7.Visible = false;
pictureBox8.Visible = true;
pictureBox9.Visible = true;
}
else if (pictureBox7.Visible == false)
{
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = true;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
}
}
private void timer8_Tick(object sender, EventArgs e)
{
if (pictureBox8.Visible == true)
{
pictureBox2.Visible = true;
pictureBox3.Visible = true;
pictureBox4.Visible = true;
pictureBox5.Visible = true;
pictureBox6.Visible = true;
pictureBox7.Visible = true;
pictureBox8.Visible = false;
pictureBox9.Visible = true;
}
else if (pictureBox8.Visible == false)
{
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = true;
pictureBox9.Visible = false;
}
}
private void timer9_Tick(object sender, EventArgs e)
{
if (pictureBox9.Visible == true)
{
pictureBox2.Visible = true;
pictureBox3.Visible = true;
pictureBox4.Visible = true;
pictureBox5.Visible = true;
pictureBox6.Visible = true;
pictureBox7.Visible = true;
pictureBox8.Visible = true;
pictureBox9.Visible = false;
}
else if (pictureBox9.Visible == false)
{
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = true;
timer2.Stop();
timer3.Stop();
timer4.Stop();
timer5.Stop();
timer6.Stop();
timer7.Stop();
timer8.Stop();
timer9.Stop();
timer2.Start();
timer3.Start();
timer4.Start();
timer5.Start();
timer6.Start();
timer7.Start();
timer8.Start();
timer9.Start();
}
}
}
}