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;
            }
        }

  • 相关阅读:
    量身打造自己的MyEclipse(多图)
    DevExpress v17.2新版亮点—WPF篇(五)
    DevExpress WPF入门指南:绑定编辑器对话框
    MyEclipse 2017 Stable 2.0发布|附下载
    springmvc常用注解标签详解
    什么是SpringMVC?
    SpringBoot页面渲染
    怎样理解Spring的IOC和AOP?
    LESS 原理,一款css的预处理程序Less的使用
    移动端web app要使用rem实现自适应布局:font-size的响应式
  • 原文地址:https://www.cnblogs.com/qiqiBoKe/p/3109343.html
Copyright © 2011-2022 走看看