闹钟计时器(简易的闹钟提示)

时间:2014-07-12 04:43:33
【文件属性】:
文件名称:闹钟计时器(简易的闹钟提示)
文件大小:920B
文件格式:SLN
更新时间:2014-07-12 04:43:33
闹钟 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; using System.Runtime.InteropServices; using Microsoft.VisualBasic; namespace ClockAlarm { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [DllImport("kernel32", EntryPoint = "Beep")] public extern static int Beep(int dwfreq,int dwduration); public int intHour, intMouit, intSecon; private void Form1_Load(object sender, EventArgs e) { string strHour = DateTime.Now.TimeOfDay.Hours.ToString(); string strMouit = DateTime.Now.TimeOfDay.Minutes.ToString(); string strSecon = DateTime.Now.TimeOfDay.Seconds.ToString(); if (Convert.ToInt32(strHour) < 10) { strHour = "0" + strHour; } if (Convert.ToInt32(strMouit) < 10) { strMouit = "0" + strMouit; } if (Convert.ToInt32(strSecon) < 10) { strSecon = "0" + strSecon; } textBox2.Text = strHour + ":" + strMouit + ":" + strSecon; intHour= Convert.ToInt32(strHour); intMouit = Convert.ToInt32(strMouit); intSecon = Convert.ToInt32(strSecon); numericUpDown3.Value = Convert.ToInt32(strHour); numericUpDown2.Value = Convert.ToInt32(strMouit); numericUpDown1.Value = Convert.ToInt32(strSecon); } private void timer1_Tick(object sender, EventArgs e) { string strHour = DateTime.Now.TimeOfDay.Hours.ToString(); string strMouit = DateTime.Now.TimeOfDay.Minutes.ToString(); string strSecon = DateTime.Now.TimeOfDay.Seconds.ToString(); if (Convert.ToInt32(strHour) < 10) { strHour = "0" + strHour; } if (Convert.ToInt32(strMouit) < 10) { strMouit = "0" + strMouit; } if (Convert.ToInt32(strSecon) < 10) { strSecon = "0" + strSecon; } textBox1.Text = strHour + ":" + strMouit + ":" + strSecon; }

网友评论