在使用了media player sdk 后,如何设置其控件中的播放暂停等按纽,
controls.play;播放
controls.pause;暂停
controls.stop;停止
controls.currentPosition:double;当前进度
这些控件按纽.
//
// groupBox1
//
this.groupBox1.Controls.Add(this.axWindowsMediaPlayer1);
this.groupBox1.Location = new System.Drawing.Point(8, 18);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(336, 296);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "正在播放";
//
// axWindowsMediaPlayer1
//
this.axWindowsMediaPlayer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.axWindowsMediaPlayer1.Enabled = true;
this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(3, 17);
this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));
this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(330, 276);
this.axWindowsMediaPlayer1.TabIndex = 0;
this.axWindowsMediaPlayer1.Enter += new System.EventHandler(this.axWindowsMediaPlayer1_Enter);
controls.play;播放
controls.pause;暂停
controls.stop;停止
controls.currentPosition:double;当前进度
这些控件按纽.
//
// groupBox1
//
this.groupBox1.Controls.Add(this.axWindowsMediaPlayer1);
this.groupBox1.Location = new System.Drawing.Point(8, 18);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(336, 296);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "正在播放";
//
// axWindowsMediaPlayer1
//
this.axWindowsMediaPlayer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.axWindowsMediaPlayer1.Enabled = true;
this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(3, 17);
this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));
this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(330, 276);
this.axWindowsMediaPlayer1.TabIndex = 0;
this.axWindowsMediaPlayer1.Enter += new System.EventHandler(this.axWindowsMediaPlayer1_Enter);
axWindowsMediaPlayer1.currentMedia.name; //获取正在播放的媒体文件的名称
axWindowsMediaPlayer1.Ctlcontrols.Play 播放
axWindowsMediaPlayer1.Ctlcontrols.Stop 停止
axWindowsMediaPlayer1.Ctlcontrols.Pause 暂停
axWindowsMediaPlayer1.Ctlcontrols.PlayCount 文件播放次数
axWindowsMediaPlayer1.Ctlcontrols.AutoRewind 是否循环播放 (无效)
axWindowsMediaPlayer1.Ctlcontrols.Balance 声道
axWindowsMediaPlayer1.Ctlcontrols.Volume 音量
axWindowsMediaPlayer1.Ctlcontrols.Mute 静音
axWindowsMediaPlayer1.EnableContextMenu 是否允许在控件上点击鼠标右键时弹出快捷菜单
axWindowsMediaPlayer1.Ctlcontrols.AnimationAtStart 是否在播放前先播放动画(无效)
axWindowsMediaPlayer1.Ctlcontrols.ShowControls 是否显示控件工具栏(无效)
axWindowsMediaPlayer1.Ctlcontrols.ShowAudioControls 是否显示声音控制按钮(无效)
axWindowsMediaPlayer1.Ctlcontrols.ShowDisplay 是否显示数据文件的相关信息(无效)
axWindowsMediaPlayer1.Ctlcontrols.ShowGotoBar 是否显示Goto栏(无效)
axWindowsMediaPlayer1.Ctlcontrols.ShowPositionControls 是否显示位置调节按钮(无效)
axWindowsMediaPlayer1.Ctlcontrols.ShowStatusBar 是否显示状态栏(无效)
axWindowsMediaPlayer1.Ctlcontrols.ShowTracker 是否显示进度条(无效)
axWindowsMediaPlayer1.Ctlcontrols.FastForward 快进
axWindowsMediaPlayer1.Ctlcontrols.FastReverse 快退
axWindowsMediaPlayer1.Ctlcontrols.Rate 快进/快退速率
axWindowsMediaPlayer1.AllowChangeDisplaySize 是否允许自由设置播放图象大小(无效)
axWindowsMediaPlayer1.DisplaySize 设置播放图象大小(无效)
用于播放多媒体文件,其格式为:
窗体名.控件名.Ctlcontrols.play()
如: AxWindowsMediaPlayer1.Ctlcontrols.play()
(2) 方法pause
用于暂停正在播放的多媒体文件,其格式为:
窗体名.控件名.Ctlcontrols.pause()
如: AxWindowsMediaPlayer1.Ctlcontrols.pause()
(3) 方法stop
用于停止正在播放的多媒体文件,其格式为:
窗体名.控件名.Ctlcontrols.stop()
如: AxWindowsMediaPlayer1.Ctlcontrols.stop()
(4) 方法fastforward
用于将正在播放的多媒体文件快进,其格式为:
窗体名.控件名.Ctlcontrols.fastforward()
如: AxWindowsMediaPlayer1.Ctlcontrols.forward()
(5) 方法fastreverse
窗体名.控件名.Ctlcontrols.fastreverse()
如: AxWindowsMediaPlayer1.Ctlcontrols.fastreverse()
6. 属性CurrentPosition
用于获取多媒体文件当前的播放进度,其值是数值类型,使用格式为:
窗体名.控件名.Ctlcontrols.currentPosition
d1 =AxWindowsMediaPlayer1.Ctlcontrols.currentPosition
其中d1 是一个整型变量。
7. 属性Duration
用于获取当前多媒体文件的播放的总时间,其值为数值类型,其使用格式为:
窗体名.控件名.currentMedia.duration
如:d2 =AxWindowsMediaPlayer1.currentMedia.duration
其中d2是一个整型变量。