Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- namespace Test {
- public partial class Form1 : Form {
- public Form1() {
- InitializeComponent();
- this.label1.Text = "10";
- }
- private int count;
- private Timer timer = new Timer();
- private void Form1_Load(object sender, EventArgs e) {
- count = Convert.ToInt32(this.label1.Text);
- timer.Interval = 1000;
- timer.Tick += new EventHandler(Run);
- timer.Start();
- }
- private void Run(object sender, EventArgs e) {
- --count;
- if (count > 0) this.label1.Text = count.ToString();
- else {
- this.label1.Text = "Конец!";
- timer.Dispose();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement