Timer

Скрыть

Показать

Копировать
  Form1.cs  
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace _0077 {
 public partial class Form1 : Form {
  public Form1() {
   InitializeComponent();
  }
  //кнопка Start
  private void buttonStart_Click(object sender, EventArgs e) {
   timer1.Start();
   //timer1.Enabled = true;
   label1.Visible = true;
  }
  //кнопка Stop
  private void buttonStop_Click(object sender, EventArgs e) {
   timer1.Stop();
   //timer1.Enabled = false;
   label1.Visible = false;
  }
  //timer
  private void timer1_Tick(object sender, EventArgs e) {
   label1.Text = string.Format("{0:T}", DateTime.Now);
  }
 }
}