78 lines
1.7 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp5
{
public partial class Form2 : Form
{
int s = 0;
int m = 0;
int h = 0;
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
s = (int)numericUpDown3.Value;
m = (int)numericUpDown2.Value;
h = (int)numericUpDown1.Value;
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (s > 0)
{
s--;
}
else if (m > 0)
{
m--;
s = 59;
}
else if (h > 0)
{
h--;
m = 59;
s = 59;
}
else
{
timer1.Stop();
MessageBox.Show("Время вышло");
}
label4.Text = h.ToString();
label5.Text = m.ToString();
label6.Text = s.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
}
private void button3_Click(object sender, EventArgs e)
{
timer1.Stop();
s = 0;
m = 0;
h = 0;
label4.Text = h.ToString();
label5.Text = m.ToString();
label6.Text = s.ToString();
}
}
}