日期:2014-05-17 浏览次数:21293 次
/*
* 程序头部注释开始
* 程序的版权和版本声明部分
* Copyright (c) 2011, 烟台大学计算机学院学生
* All rights reserved.
* 文件名称:电子时钟
* 作 者:薛广晨
* 完成日期:2012 年 11 月 19 日
* 版 本号:x1.0
* 对任务及求解方法的描述部分
* 输入描述:
* 问题描述:
* 程序输出:
* 程序头部的注释结束
*/
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 WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToLocalTime().ToString();
}
private void button3_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
timer1.Dispose();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToLocalTime().ToString();
timer1.Start();
}
}
}
运行结果:
