首先添加控件
我们只需要这两个就够了
然后是代码
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 时钟
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToString()
}
}
}
这样就完成了
当然还可以在修饰修饰 就看自己了