Time时间表

来源:互联网 发布:办公软件mac版免费 编辑:程序博客网 时间:2024/05/19 02:26

先建windows窗体应用程序,再建自定仪窗体

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace teibin24
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.label1.Text = System.DateTime.Now.ToString()+System.DateTime.Now.Millisecond.ToString();
            timer1.Interval = 1000;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (button1.Text == "stop")
            {
                button1.Text = "Start";
                timer1.Enabled = false;
            }
            else
            {
                button1.Text = "stop";
                timer1.Enabled = true;
            }
        }
      
       
    }
}