zoukankan      html  css  js  c++  java
  • winfrom实现闹钟

     

     

    后台代码:

     

       Clock myClock = new Clock();         public Form1()         {             InitializeComponent();         }
            private void btnBrowse_Click(object sender, EventArgs e)         {
                DialogResult result = openFileDialog1.ShowDialog();             if (result.ToString() == "OK")             {                 txtMusicPath.Text = openFileDialog1.FileName;             }         }
            private void btnConfirm_Click(object sender, EventArgs e)         {             if (txtMusicPath.Text != "" && txtTime.Text != "")             {                 myClock.confrimTime =Convert.ToDateTime(txtTime.Text).ToString("yyyy-MM-dd hh:mm:ss");                 myClock.musicPath = txtMusicPath.Text;                 MessageBox.Show("设定成功");             }         }
            private void timer1_Tick(object sender, EventArgs e)         {            if (myClock.isPlay())             {                 axWindowsMediaPlayer1.URL = myClock.musicPath;                 axWindowsMediaPlayer1.Ctlcontrols.play();             }         }

     

    引用的类

    public class Clock

        {
            public string confrimTime { set; get; }
            public string musicPath { set; get; }


            public bool isPlay()
            {
                if (confrimTime == DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"))
                {
                    return true;
                }
                return false;
            }
        }

  • 相关阅读:
    文件上传笔记
    使用customize-cra,react-app-rewired扩展create-react-app
    regeneratorRuntime is not defined报错处理
    gulp使用笔记
    pyinstaller打包带图标时报错问题
    不使用npm eject 修改create-react-app的wepack配置less-loader
    mockjs使用笔记
    树莓派安装TPLINK_WN725n v2网卡驱动
    csv数据文件如何设置
    Jmeter多线程token传递
  • 原文地址:https://www.cnblogs.com/qiqiBoKe/p/3109343.html
Copyright © 2011-2022 走看看