C#学习.简单的闹钟程序

    技术2022-07-10  118

    1,.创建一个label控件,一个Timer控件

    2.设置下Timer属性,1s触发一次

    3.添加Timer触发事件,某个时间点,播放音乐

                lblTime.Text = DateTime.Now.ToString();//label控件上显示当前时间             if(DateTime.Now.Hour ==16&&DateTime.Now.Minute==52&&DateTime.Now.Second==0)//判断是否到时间点             {

                    //播放音乐                 SoundPlayer sp = new SoundPlayer();                 sp.SoundLocation = @"E:\Judge_102030.wav";                 sp.Play();             }

    Processed: 0.009, SQL: 9