I have display timer that resets after a four seconds and on display i wanna it count down instead of up. Here is my code:
private void TimerTick1()
{
string time2;
TimeSpan timeElapsed = DateTime.Now - startTime;
time = timeElapsed.TotalSeconds.ToString("0.0");
time2 = timeElapsed.TotalSeconds.ToString("0.0");
time2 = Reverses(time2);
label1.Text = time2;
Console.WriteLine(time2);
secs = float.Parse(time);
if (secs >= 4.000f)
{
seq = seq + 1; // image sequence
startTime = DateTime.Now;
}
//====================image==============================
if (clas == 1)
{
if (seq == 3)
{
seq = 0;
}
if (seq == 0)
{
pictureBox1.Image = CoEtimer.Properties.Resources.convice;
}
if (seq == 1)
{
pictureBox1.Image = CoEtimer.Properties.Resources.convphys;
}
if (seq == 2)
{
pictureBox1.Image = CoEtimer.Properties.Resources.convgreen;
}
} else if (clas == 2)
{
if (seq == 4)
{
seq = 0;
}
if (seq == 0)
{
pictureBox1.Image = CoEtimer.Properties.Resources.convarca;
}
if (seq == 1)
{
pictureBox1.Image = CoEtimer.Properties.Resources.convice;
}
if (seq == 2)
{
pictureBox1.Image = CoEtimer.Properties.Resources.convfire;
}
if (seq == 3)
{
pictureBox1.Image = CoEtimer.Properties.Resources.convlight;
}
}
}
public static string Reverses(string s)
{
char[] chararray = s.ToCharArray();
Array.Reverse(chararray);
string Txt = string.Empty;
for (int i = 0; i <= chararray.Length - 1; i++)
{
Txt += chararray.GetValue(i);
}
Console.WriteLine(Txt);
return Txt;
}
but it just replaces number's position. Any way to do that?