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 WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
//this.label1.Text = DateTime.Now.ToString();
DateTime t1 = DateTime.Now;
this.label1.Text = t1.ToString();
DateTime t2 = this.dateTimePicker1.Value;
TimeSpan ts = t2 - t1;
this.label2.Text = String.Format("{0}天{1}小时{2}分{3}秒", ts.Days, ts.Hours, ts.Minutes, ts.Seconds);
//string strYmd = this.dateTimePicker1.Value.ToString("yyyy-MM-dd");
//DateTime dt = Convert.ToDateTime(strYmd);
//int inth = Convert.ToInt32(this.numericUpDown1.Value);
//dt = dt.AddHours(inth);
}
private void label1_Click(object sender, EventArgs e)
{
this.label1.Text = DateTime.Now.ToString();
this.timer1.Interval = 1000;
this.timer1.Enabled = true;
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
}
}
}
一年前的草稿箱的……真的忘哒