框架:
代码:
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;
using System.Media;//添加音乐时命名空间
namespace _02闹钟
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox2.Text = DateTime.Now.ToString();//页面加载时获取当前时间
}
bool b = false;//这个变量记录时间是否到了
private void timer1_Tick(object sender, EventArgs e)
{
textBox2.Text = DateTime.Now.ToString();//timer每一秒运行一次更新一次值
if