Look, create a function called setInterval to pass the time I want it to take for each label to appear and a callback with what I want to run in that time.
private void SetInterval(int interval, EventHandler callback)
{
//Creo el temporizador
Timer timer = new Timer();
//Le establezco el intervalo en el que va a repetir la operación
timer.Interval = interval;
//Asigno que se ejecutara al llegar el tiempo estimado
timer.Tick += (obj, ev) =>
{
//En este caso ejecuto el callback que paso como parametro
callback(obj, ev);
};
//Inicializo el temporizador
timer.Start();
}
Now in the onClick event of the button I call setInterval and I check if the buttons are visible and I show them progressively, I have two ways one that is difficult to maintain if you are going to increase the labels to be displayed and another one that is more optimal , I'm going to put both of you and you decide which one to use
EASY:
SetInterval(1000, (obj, ev) =>
{
if (!label1.Visible)
{
label1.Show();
}
else if (!label2.Visible)
{
label2.Show();
}
else if (!label3.Visible)
{
label3.Show();
}
else if(!label4.Visible)
{
label4.Show();
}
});
MORE OPTIMAL:
//Aqui guardo todos los labels que quiero mostrar progresivamente ordenados por el orden de aparición
Control[] labels = new Control[] { label1, label2, label3, label4 };
//Guardo la posición en la que debo comenzar en el Tag del botón
button1.Tag = 0;
//Llamo a la función creada
SetInterval(1000, (obj, ev) =>
{
//Obtengo la posición actual sobre la cual voy a trabajar
int pos = Convert.ToInt32(button1.Tag);
//Si no estoy fuera de los limites del arreglo de labels y el label esta oculto...
if (pos < labels.Length && !labels[pos].Visible)
{
//Muestro el label correspondiente por el orden
labels[pos++].Show();
//Actualizo la posición en la que se quedo del arreglo de labels
button1.Tag = pos;
}
});
I hope I have served you.