//在工具箱右擊——選擇項——COM組件——Windows media player
try
{
this.openFileDialog1.Filter = "*.mav,*wmv|*.mav,*.wmv|*.*|*.*";
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamReader sr = new StreamReader(openFileDialog1.FileName);
string playname = sr.ReadLine();
axWindowsMediaPlayer1.URL = openFileDialog1.FileName;
}
}
catch (Exception ex)
{
MessageBox.Show("不能打開文件","小宇兒提示");
}