求一个可以在线播放 avi 的播放器 各位好, 我正在做一个 winform 程序, 窗体上需要一个播放器, 用来播放 url 形式的 avi 文件. wmp 要下载完整个文件才开始播放, 由于视频太大, 所以 wmp 的效果不能接受. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 .NetFramework的库里面好像有这个组件,我试过播放本地文件,但是能不能在线播放就没试过了! 我的代码 太麻烦了 ,我是在下载处下的我不贴了你自己去看看把(参考)http://download.csdn.net/source/241674 文件不是本地的,是url,真难搞 前台代码如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WindowMediaPlayer.aspx.cs"Inherits="Players_WindowMediaPlayer" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title>window media player播放器</title><link href="../css/styles.css" type="text/css" rel="stylesheet" /><script language="javascript" type="text/javascript"><!--// 获取播放器的全屏状态信息function SetFullScreen(){document.wmp.fullScreen = true;}// 传递播放文件参数function SelectFile(_value){window.location = "WindowMediaPlayer.aspx?strFileName="+ _value;}// 获取播放器的播放状态function GetMediaPlayerState(){document.getElementById("playerTotalTime").value = document.wmp.currentMedia.durationString;document.getElementById("playerCurrentlyTime").value = document.wmp.controls.currentPositionString;}//--></script></head><body><form id="form1" runat="server"><div><table width="98%"><tr><td colspan="2" align="center">window media player播放器</td></tr><tr><td style="width: 70%;" align="center"><object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="wmp"><param name="URL" value="../playerdata/<%= strFileName%>" /><!--媒体文件地址--><param name="rate" value="1" /><param name="balance" value="0" /><!--声道0全声道,-100左声道,100右声道--><param name="currentPosition" value="0" /><param name="playCount" value="1" /><!--播放次数--><param name="autoStart" value="0" /><!--是否自动播放-1是,0否--><param name="currentMarker" value="0" /><param name="invokeURLs" value="-1" /><param name="volume" value="50" /><!--音量--><param name="mute" value="0" /><!--是否静音-1是,0否--><param name="uiMode" value="full" /><!--播放器模式full(默认)显示全部控件,none仅视频窗口,mini视频及一些常用控件,invisiblei不显示任何控件及视频窗口--><param name="stretchToFit" value="0" /><param name="windowlessVideo" value="0" /><param name="enabled" value="-1" /><param name="enableContextMenu" value="-1" /><param name="fullScreen" value="0" /><!--是否全屏--><param name="enableErrorDialogs" value="-1" /><!--是否允许出错信息提示--></object><p><span onclick="SetFullScreen();" style="cursor: hand;">全屏播放</span></p>总播放时间:<asp:TextBox ID="playerTotalTime" runat="server"></asp:TextBox><br />当前播放时间:<asp:TextBox ID="playerCurrentlyTime" runat="server"></asp:TextBox><br /><span onclick="GetMediaPlayerState();" style="cursor: hand;">手动获取状态</span></td><td style="width: 30%;" valign="top"><table width="100%"><tr><td align="center" style="height: 20px;">选择文件<hr /></td></tr><!--显示指定目录中的文件列表--><div id="divFilesList" runat="server"></div></table></td></tr></table></div><script language="javascript" type="text/javascript">// 每隔一秒钟获取一次播放器的执行总时间和当前播放时间//window.setTimeout(GetMediaPlayerState,1000); // 此方法未达到效果var id=window.setInterval(GetMediaPlayerState,1000); </script></form></body></html>后台代码如下:using System;using System.Data;using System.IO;using System.Text;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class Players_WindowMediaPlayer : System.Web.UI.Page{public String strFileName = "";protected void Page_Load(object sender, EventArgs e){if (!this.Page.IsPostBack){if (Request.QueryString["strFileName"] != null && !Request.QueryString["strFileName"].ToString().Equals(String.Empty)){strFileName = Request.QueryString["strFileName"].ToString();}GetFilesList();}}// 获取文件列表private void GetFilesList(){StringBuilder sb = new StringBuilder();String strField = Server.MapPath("~/PlayerData/");//针对当前目录建立目录引用对象DirectoryInfo dirInfo = new DirectoryInfo(strField);foreach (FileInfo fi in dirInfo.GetFiles()){sb.AppendFormat("<tr><td><span onclick=\"SelectFile('{0}');\">{0}</span></td></tr>",fi.Name);}sb.AppendFormat("<tr><td><hr></td></tr><tr align=\"right\"><td>共{0}个文件</td></tr>", dirInfo.GetFiles().Length.ToString());divFilesList.InnerHtml = sb.ToString();}} using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace 多媒体 { /// <summary> /// Form1 的摘要说明。 /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1; /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer(); ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(88, 424); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(96, 32); this.button1.TabIndex = 1; this.button1.Text = "打开文件"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(336, 424); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(96, 32); this.button2.TabIndex = 2; this.button2.Text = "退出"; this.button2.Click += new System.EventHandler(this.button2_Click); // // axWindowsMediaPlayer1 // this.axWindowsMediaPlayer1.Enabled = true; this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(0, 0); this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1"; this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState"))); this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(592, 416); this.axWindowsMediaPlayer1.TabIndex = 3; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(592, 466); this.Controls.Add(this.axWindowsMediaPlayer1); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "播放器"; ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit(); this.ResumeLayout(false); } #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void button1_Click(object sender, System.EventArgs e) { //MPEG AVI WAV MIDI openFileDialog1.ShowDialog(); axWindowsMediaPlayer1.Name = openFileDialog1.FileName; axWindowsMediaPlayer1.Size = new Size(axWindowsMediaPlayer1.Size.Width, axWindowsMediaPlayer1.Size.Height); } private void button2_Click(object sender, System.EventArgs e) { this.Close(); } } }using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace WindowsApplication1 { /// <summary> /// Form1 的摘要说明。 /// </summary> public class Form1 : System.Windows.Forms.Form { private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.OpenFileDialog openFileDialog1; /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit(); this.SuspendLayout(); // // axWindowsMediaPlayer1 // this.axWindowsMediaPlayer1.Enabled = true; this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(0, 0); this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1"; this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState"))); this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(344, 224); this.axWindowsMediaPlayer1.TabIndex = 0; // // button1 // this.button1.Location = new System.Drawing.Point(136, 248); this.button1.Name = "button1"; this.button1.TabIndex = 1; this.button1.Text = "播放"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(248, 248); this.button2.Name = "button2"; this.button2.TabIndex = 2; this.button2.Text = "暂停"; this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // this.button3.Location = new System.Drawing.Point(16, 248); this.button3.Name = "button3"; this.button3.TabIndex = 3; this.button3.Text = "打开"; this.button3.Click += new System.EventHandler(this.button3_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(344, 295); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.axWindowsMediaPlayer1); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit(); this.ResumeLayout(false); } #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void button3_Click(object sender, System.EventArgs e) { if(this.openFileDialog1.ShowDialog()==DialogResult.OK) { this.axWindowsMediaPlayer1.URL=this.openFileDialog1.FileName; } this.axWindowsMediaPlayer1.Ctlcontrols.stop(); } private void button1_Click(object sender, System.EventArgs e) { this.axWindowsMediaPlayer1.Ctlcontrols.play(); } private void button2_Click(object sender, System.EventArgs e) { this.axWindowsMediaPlayer1.Ctlcontrols.pause(); } } } PDA 访问 MySQL数据库 如何保存图片至服务器目录 VC#.net数据库问题 十万火急--Gridview的用法 在vs.net里搞个上传图片的过程是怎么样的?谁能说下步骤吗?谢谢!! 如何在一个图像下创建一个阴影? 有关于异常处理的问题 急需帮助,分数要多少都可以,另加。 c#真的会替代c++吗?谁能列出c#强于c++的地方? 急!如何用c#实现与sqlserver200的连接并实现olap的在线分析 C# 用TWAIN 协助扫描图片的问题 C# 图表?
我不贴了
你自己去看看把(参考)
http://download.csdn.net/source/241674
Inherits="Players_WindowMediaPlayer" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>window media player播放器</title>
<link href="../css/styles.css" type="text/css" rel="stylesheet" /><script language="javascript" type="text/javascript">
<!--
// 获取播放器的全屏状态信息
function SetFullScreen()
{
document.wmp.fullScreen = true;
}// 传递播放文件参数
function SelectFile(_value)
{
window.location = "WindowMediaPlayer.aspx?strFileName="+ _value;
}// 获取播放器的播放状态
function GetMediaPlayerState()
{
document.getElementById("playerTotalTime").value = document.wmp.currentMedia.durationString;
document.getElementById("playerCurrentlyTime").value = document.wmp.controls.currentPositionString;
}
//-->
</script></head>
<body>
<form id="form1" runat="server">
<div>
<table width="98%">
<tr>
<td colspan="2" align="center">
window media player播放器
</td>
</tr>
<tr>
<td style="width: 70%;" align="center">
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="wmp">
<param name="URL" value="../playerdata/<%= strFileName%>" />
<!--媒体文件地址-->
<param name="rate" value="1" />
<param name="balance" value="0" />
<!--声道0全声道,-100左声道,100右声道-->
<param name="currentPosition" value="0" />
<param name="playCount" value="1" />
<!--播放次数-->
<param name="autoStart" value="0" />
<!--是否自动播放-1是,0否-->
<param name="currentMarker" value="0" />
<param name="invokeURLs" value="-1" />
<param name="volume" value="50" />
<!--音量-->
<param name="mute" value="0" />
<!--是否静音-1是,0否-->
<param name="uiMode" value="full" />
<!--播放器模式full(默认)显示全部控件,none仅视频窗口,mini视频及一些常用控件,invisiblei不显示任何控件及视频窗口-->
<param name="stretchToFit" value="0" />
<param name="windowlessVideo" value="0" />
<param name="enabled" value="-1" />
<param name="enableContextMenu" value="-1" />
<param name="fullScreen" value="0" />
<!--是否全屏-->
<param name="enableErrorDialogs" value="-1" />
<!--是否允许出错信息提示-->
</object>
<p>
<span onclick="SetFullScreen();" style="cursor: hand;">全屏播放</span>
</p>
总播放时间:<asp:TextBox ID="playerTotalTime" runat="server"></asp:TextBox>
<br />
当前播放时间:<asp:TextBox ID="playerCurrentlyTime" runat="server"></asp:TextBox>
<br />
<span onclick="GetMediaPlayerState();" style="cursor: hand;">手动获取状态</span>
</td>
<td style="width: 30%;" valign="top">
<table width="100%">
<tr>
<td align="center" style="height: 20px;">
选择文件
<hr />
</td>
</tr>
<!--显示指定目录中的文件列表-->
<div id="divFilesList" runat="server">
</div>
</table>
</td>
</tr>
</table>
</div><script language="javascript" type="text/javascript">
// 每隔一秒钟获取一次播放器的执行总时间和当前播放时间//window.setTimeout(GetMediaPlayerState,1000); // 此方法未达到效果var id=window.setInterval(GetMediaPlayerState,1000);
</script></form>
</body>
</html>后台代码如下:using System;
using System.Data;
using System.IO;
using System.Text;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Players_WindowMediaPlayer : System.Web.UI.Page
{
public String strFileName = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
{
if (Request.QueryString["strFileName"] != null && !Request.QueryString["strFileName"].ToString().Equals(String.Empty))
{
strFileName = Request.QueryString["strFileName"].ToString();
}GetFilesList();
}
}// 获取文件列表
private void GetFilesList()
{
StringBuilder sb = new StringBuilder();
String strField = Server.MapPath("~/PlayerData/");//针对当前目录建立目录引用对象
DirectoryInfo dirInfo = new DirectoryInfo(strField);foreach (FileInfo fi in dirInfo.GetFiles())
{
sb.AppendFormat("<tr><td><span onclick=\"SelectFile('{0}');\">{0}</span></td></tr>",fi.Name);
}sb.AppendFormat("<tr><td><hr></td></tr><tr align=\"right\"><td>共{0}个文件</td></tr>", dirInfo.GetFiles().Length.ToString());divFilesList.InnerHtml = sb.ToString();
}
}
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data; namespace 多媒体
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer();
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(88, 424);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(96, 32);
this.button1.TabIndex = 1;
this.button1.Text = "打开文件";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(336, 424);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(96, 32);
this.button2.TabIndex = 2;
this.button2.Text = "退出";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// axWindowsMediaPlayer1
//
this.axWindowsMediaPlayer1.Enabled = true;
this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(0, 0);
this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));
this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(592, 416);
this.axWindowsMediaPlayer1.TabIndex = 3;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(592, 466);
this.Controls.Add(this.axWindowsMediaPlayer1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "播放器";
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit();
this.ResumeLayout(false);
}
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void button1_Click(object sender, System.EventArgs e)
{
//MPEG AVI WAV MIDI
openFileDialog1.ShowDialog();
axWindowsMediaPlayer1.Name = openFileDialog1.FileName;
axWindowsMediaPlayer1.Size = new Size(axWindowsMediaPlayer1.Size.Width,
axWindowsMediaPlayer1.Size.Height);
} private void button2_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data; namespace WindowsApplication1
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit();
this.SuspendLayout();
//
// axWindowsMediaPlayer1
//
this.axWindowsMediaPlayer1.Enabled = true;
this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(0, 0);
this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));
this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(344, 224);
this.axWindowsMediaPlayer1.TabIndex = 0; //
// button1
//
this.button1.Location = new System.Drawing.Point(136, 248);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "播放";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(248, 248);
this.button2.Name = "button2";
this.button2.TabIndex = 2;
this.button2.Text = "暂停";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(16, 248);
this.button3.Name = "button3";
this.button3.TabIndex = 3;
this.button3.Text = "打开";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(344, 295);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.axWindowsMediaPlayer1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit();
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void button3_Click(object sender, System.EventArgs e)
{
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
this.axWindowsMediaPlayer1.URL=this.openFileDialog1.FileName;
} this.axWindowsMediaPlayer1.Ctlcontrols.stop();
}
private void button1_Click(object sender, System.EventArgs e)
{
this.axWindowsMediaPlayer1.Ctlcontrols.play();
} private void button2_Click(object sender, System.EventArgs e)
{
this.axWindowsMediaPlayer1.Ctlcontrols.pause();
}
}
}