基本信息
源码名称:C# 自动播放音乐 软件源码下载
源码大小:8.23M
文件格式:.rar
开发语言:C#
更新时间:2016-08-12
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

这是一款自用的小程序,定时自动播放音乐。界面如下,很简洁。能自动跳过周六和周天。


需要启用 Windows Media Player 功能,否则会提示【System.Runtime.InteropServices.COMException:“没有注册类】

操作步骤:控制面板>>程序>>启用或者关闭windows 功能>>选中 媒体功能>>Windows Media Player,点击确定即可

   //设置定时时间
        public int SetTime(string str)
        {
            int tt = 0;
            bool b = int.TryParse(str, out tt);
            if (str != "")
            {
                if (b == true)
                {
                    if (tt >= 0 && tt <= 9)
                    {
                        str = "0" tt.ToString();
                    }
                    str = tt.ToString();
                    tt = Convert.ToInt32(str);
                }
                else
                {
                    timer1.Enabled = false;
                    btnStart.Text = "启动";
                    MessageBox.Show("请输入数字!");
                }
            }
            else
            {
                MessageBox.Show("请设置时间!");
            }
            return tt;

       //定时播放音乐

        public void PlaySongs()
        {
            List<string> list = new List<string>();
            list.Add(Directory.GetCurrentDirectory());
            list.Add(@"\1.mp3");
            string filePath = list[0] list[1];
            axWindowsMediaPlayer1.URL = filePath;
            axWindowsMediaPlayer1.Ctlcontrols.play();
            axWindowsMediaPlayer1.settings.playCount = 2;
        }