文件名称:c#闹钟代码
文件大小:411KB
文件格式:PDF
更新时间:2016-02-04 12:47:24
c#闹钟代码
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 b35 { public partial class Form1 : Form { bool flag=false ; DateTime mytime; public Form1() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { this.label1.Text = Convert.ToString(DateTime.Now); if (( DateTime.Now == mytime ) && (flag ==true )) this.axWindowsMediaPlayer1.URL = @"d:\Hello.wav"; } private void button1_Click(object sender, EventArgs e) { if ((textBox1.Text) == "") { MessageBox.Show("请输入定时时间"); } else { flag = true; mytime = Convert.ToDateTime(textBox1.Text); this.Text = mytime.ToString(); } } private void Form1_Load_1(object sender, EventArgs e) { timer1.Interval = 1000; this.label1.Text = Convert.ToString(DateTime.Now); } } }