元旦快乐,阖家团圆,幸福安康.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;/*命名空间提供简化编写并发和异步代码的工作的类型。*/
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Diagnostics;/*表示 Windows NT 性能计数器组件。 */
using 西哈 = System.Collections;
using System.Windows.Forms.DataVisualization.Charting;/*图表*/
namespace WindowsForms测试
{
public partial class Form1 : Form
{
WMPLib.WindowsMediaPlayer Player;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Stopwatch 总运行时间 = Stopwatch.StartNew();
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "Audio Files (.MP3)|*.MP3";
if (dialog.ShowDialog() == DialogResult.OK)
{
Player = new WMPLib.WindowsMediaPlayer(/*添加引用Interop.WMPLib.dll文件*/);
Player.settings.volume = 100;
Player.URL = dialog.FileName;
Player.controls.play();
//Player.controls.stop();
}
MessageBox.Show("总运行时间: " + 总运行时间.ElapsedMilliseconds.ToString("000000sm"));
}
}
}
http://cn.bing.com/search?q=axWindowsMediaPlayer&src=IE-TopResult&FORM=IE11TR&conversationid=&pc=EUPP_