C# Winform 中如何实现音乐播放和视频播放
C# Winform 中如何实现音乐播放和视频播放
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
SoundPlayer sp = new SoundPlayer("C:/Users/xingping.xu/Documents/Visual Studio 2010/Projects/ConsoleApplication1/ConsoleApplication1/BeautifulTonight.wav");//必须是带.wav扩展名的音频文件
//sp.PlayLooping();//循环播放
//axWindowsMediaPlayer1.URL = "D:/Vedios/2010南非世界杯进球集锦2010.DIY版-CSDHD-01.avi";
axWindowsMediaPlayer1.settings.setMode("loop",true);
List<string> playlist=new List<string>();
playlist.Add("D:/Vedios/2010南非世界杯进球集锦2010.DIY版-CSDHD-01.avi");
playlist.Add("D:/Vedios/2010南非世界杯进球集锦2010.DIY版-CSDHD-02.avi");
foreach (string item in playlist)
{
axWindowsMediaPlayer1.currentPlaylist.appendItem(axWindowsMediaPlayer1.newMedia(item));
}
}
}
}