C#制作简易播放器

.net framework里有了许多COM组件,我们可以根据应用程序的需要来使用这些组件,不用自己再去 “造轮子”了。<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

第一个示例是来制作一个VCD播放器.这里我使用了Windows自带的Media Play来播放多媒体文件。

06121401.JPG

选择工具箱’—‘组件,右击,选择添加/移除项’—‘COM组件(如果你是第一次使用Windows Media Play控件,在列表中是没有这个控件的,可以在系统文件夹下找到,一般是在C:/Windows/System32/msdxm.ocx,把这个控件加入到控件列表中,就可以使用了。

代码如下:

None.gif using System;
None.gif
using System.Drawing;
None.gif
using System.Collections;
None.gif
using System.ComponentModel;
None.gif
using System.Windows.Forms;
None.gif
using System.Data;
None.gif
None.gif
namespace MPlayDemo
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif
publicclassForm1:System.Windows.Forms.Form
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
privateAxMediaPlayer.AxMediaPlayeraxMediaPlayer1;
InBlock.gif
InBlock.gif
InBlock.gif
publicForm1()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifInitializeComponent();
ExpandedSubBlockEnd.gif}

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif
dot.gif#region
InBlock.gif
privatevoidInitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMediaPlayer1=newAxMediaPlayer.AxMediaPlayer();
InBlock.gif
//
InBlock.gif
//axMediaPlayer1
InBlock.gif
//
InBlock.gif
this.axMediaPlayer1.Dock=System.Windows.Forms.DockStyle.Top;
InBlock.gif
this.axMediaPlayer1.Location=newSystem.Drawing.Point(0,0);
InBlock.gif
this.axMediaPlayer1.Name="axMediaPlayer1";
InBlock.gif
this.axMediaPlayer1.OcxState=((System.Windows.Forms.AxHost.State)(resources.GetObject("axMediaPlayer1.OcxState")));
InBlock.gif
this.axMediaPlayer1.Size=newSystem.Drawing.Size(488,376);
InBlock.gif
this.axMediaPlayer1.TabIndex=0;
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif
#endregion

InBlock.gif
InBlock.gif
privatevoidbtnPlay_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.axMediaPlayer1.FileName.Trim()=="")
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择要播放的文件!!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
return;
ExpandedSubBlockEnd.gif}

InBlock.gif
this.axMediaPlayer1.Play();
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnPause_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.axMediaPlayer1.FileName.Trim()=="")
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择要播放的文件!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
return;
ExpandedSubBlockEnd.gif}

InBlock.gif
this.axMediaPlayer1.Pause();
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnStop_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.axMediaPlayer1.FileName.Trim()=="")
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择要播放的文件","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
return;
ExpandedSubBlockEnd.gif}

InBlock.gif
this.axMediaPlayer1.Stop();
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
InBlock.gif
privatevoidmenuItem3_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifApplication.Exit();
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidmenuItem2_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.openFileDialog1.ShowDialog();
InBlock.gif
stringstrFileName=this.openFileDialog1.FileName;
InBlock.gif
if(strFileName.Trim()=="")
InBlock.gif
return;
InBlock.gif
this.axMediaPlayer1.FileName=strFileName;
InBlock.gif
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidmenuItem4_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMediaPlayer1.AboutBox();
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidmenuItem5_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMediaPlayer1.FastForward();
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif

第二个示例是制作一个DVD播放器:

06121402.JPG

选择工具箱’—‘组件,右击,选择添加/移除项’—‘COM组件“MSWebDVD
这个控件加入到控件列表中,就可以使用了。

代码如下:

None.gif using System;
None.gif
using System.Drawing;
None.gif
using System.Collections;
None.gif
using System.ComponentModel;
None.gif
using System.Windows.Forms;
None.gif
using System.Data;
None.gif
None.gif
namespace DVDPlayDemo
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif
publicclassForm1:System.Windows.Forms.Form
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
privateAxMSWEBDVDLib.AxMSWebDVDaxMSWebDVD1;
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif
Windows#regionWindows
InBlock.gif
privatevoidInitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMSWebDVD1=newAxMSWEBDVDLib.AxMSWebDVD();
InBlock.gif
InBlock.gif
//
InBlock.gif
//axMSWebDVD1
InBlock.gif
//
InBlock.gif
this.axMSWebDVD1.Dock=System.Windows.Forms.DockStyle.Top;
InBlock.gif
this.axMSWebDVD1.Enabled=true;
InBlock.gif
this.axMSWebDVD1.Location=newSystem.Drawing.Point(0,0);
InBlock.gif
this.axMSWebDVD1.Name="axMSWebDVD1";
InBlock.gif
this.axMSWebDVD1.OcxState=((System.Windows.Forms.AxHost.State)(resources.GetObject("axMSWebDVD1.OcxState")));
InBlock.gif
this.axMSWebDVD1.Size=newSystem.Drawing.Size(504,320);
InBlock.gif
this.axMSWebDVD1.TabIndex=0;
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif
#endregion

InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
privatevoidbtnPlay_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
try
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMSWebDVD1.Play();
ExpandedSubBlockEnd.gif}

InBlock.gif
catch(System.Exceptionex)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(ex.Message.ToString());
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnPause_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
try
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMSWebDVD1.Pause();
ExpandedSubBlockEnd.gif}

InBlock.gif
catch(System.Exceptionex)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(ex.Message.ToString());
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnStop_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
try
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMSWebDVD1.Stop();
ExpandedSubBlockEnd.gif}

InBlock.gif
catch(System.Exceptionex)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(ex.Message.ToString());
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnOut_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
try
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMSWebDVD1.Eject();
ExpandedSubBlockEnd.gif}

InBlock.gif
catch(System.Exceptionex)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(ex.Message.ToString());
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif}

None.gif

第三个示例是制作一个Flash播放器。选择工具箱’—‘组件,右击,选择添加/移除项’—‘COM组件“Shockwave Flash Object”这个控件加入到控件列表中,就可以使用了。

06121403.JPG

None.gif using System;
None.gif
using System.Drawing;
None.gif
using System.Collections;
None.gif
using System.ComponentModel;
None.gif
using System.Windows.Forms;
None.gif
using System.Data;
None.gif
None.gif
namespace FlashPlayDemo
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif
publicclassForm1:System.Windows.Forms.Form
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
InBlock.gif
privateAxShockwaveFlashObjects.AxShockwaveFlashaxShockwaveFlash1;
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif
dot.gif#region
InBlock.gif
privatevoidInitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
InBlock.gif
this.axShockwaveFlash1=newAxShockwaveFlashObjects.AxShockwaveFlash();
InBlock.gif
InBlock.gif
//
InBlock.gif
//axShockwaveFlash1
InBlock.gif
//
InBlock.gif
this.axShockwaveFlash1.Dock=System.Windows.Forms.DockStyle.Top;
InBlock.gif
this.axShockwaveFlash1.Enabled=true;
InBlock.gif
this.axShockwaveFlash1.Location=newSystem.Drawing.Point(0,0);
InBlock.gif
this.axShockwaveFlash1.Name="axShockwaveFlash1";
InBlock.gif
this.axShockwaveFlash1.OcxState=((System.Windows.Forms.AxHost.State)(resources.GetObject("axShockwaveFlash1.OcxState")));
InBlock.gif
this.axShockwaveFlash1.Size=newSystem.Drawing.Size(680,312);
InBlock.gif
this.axShockwaveFlash1.TabIndex=0;
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif
#endregion

InBlock.gif
InBlock.gif
privatevoidmenuItem2_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axShockwaveFlash1.Movie=this.openFileDialog1.FileName;
InBlock.gif
this.Text="播放的是-"+this.openFileDialog1.FileName;
ExpandedSubBlockEnd.gif}

InBlock.gif
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnPlay_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.openFileDialog1.FileName.Length>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axShockwaveFlash1.Play();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择文件!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnStop_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.openFileDialog1.FileName.Length>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axShockwaveFlash1.Stop();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择文件!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnFisrt_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.openFileDialog1.FileName.Length>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axShockwaveFlash1.Rewind();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择文件!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnLast_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.openFileDialog1.FileName.Length>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axShockwaveFlash1.Back();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择文件!!!","信息提示“,MessageBoxButtons.OK,MessageBoxIcon.Information);
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnNext_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.openFileDialog1.FileName.Length>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axShockwaveFlash1.Forward();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择文件!!!","信息提示”,MessageBoxButtons.OK,MessageBoxIcon.Information);
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif}

None.gif

第四个示例是制作一个RealPlay播放器。选择工具箱’—‘组件,右击,选择添加/移除项’—‘COM组件‘,“RealPlayer G2 Control”这个控件加入到控件列表中,就可以使用了。

06121404.JPG

为了简单起见,就直接使用它的控制面板了,代码如下:

None.gif using System;
None.gif
using System.Drawing;
None.gif
using System.Collections;
None.gif
using System.ComponentModel;
None.gif
using System.Windows.Forms;
None.gif
using System.Data;
None.gif
None.gif
namespace RealPlayDemo
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif
publicclassForm1:System.Windows.Forms.Form
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
privateAxRealAudioObjects.AxRealAudioaxRealAudio1;
ContractedSubBlock.gifExpandedSubBlockStart.gif
dot.gif#region
InBlock.gif
privatevoidInitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
InBlock.gif
this.axRealAudio1=newAxRealAudioObjects.AxRealAudio();
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif
#endregion

InBlock.gif
InBlock.gif
privatevoidmenuItem2_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axRealAudio1.Source=this.openFileDialog1.FileName;
InBlock.gif
this.axRealAudio1.DoPlay();
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidmenuItem3_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifApplication.Exit();
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif}

None.gif

最后一个示例是对第一个Windows Media Play播放器的扩展,用它来制作一个Mp3播放器。选择工具箱’—‘组件,右击,选择添加/移除项’—‘COM组件‘,“Windows Media Play”这个控件加入到控件列表中,就可以使用了。

06121405.JPG

代码如下:

None.gif using System;
None.gif
using System.Drawing;
None.gif
using System.Collections;
None.gif
using System.ComponentModel;
None.gif
using System.Windows.Forms;
None.gif
using System.Data;
None.gif
using System.IO;
None.gif
None.gif
namespace MP3PlayerDemo
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif
InBlock.gif
publicclassForm1:System.Windows.Forms.Form
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
privateAxMediaPlayer.AxMediaPlayeraxMediaPlayer1;
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif
dot.gif#region
InBlock.gif
privatevoidInitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMediaPlayer1=newAxMediaPlayer.AxMediaPlayer();
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif
#endregion

InBlock.gif
InBlock.gif
privatevoidmenuItem3_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifApplication.Exit();
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidmenuItem2_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.listView1.Items.Clear();
InBlock.gif
string[]FileNames=this.openFileDialog1.FileNames;
InBlock.gif
foreach(stringfNameinFileNames)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifSystem.IO.FileInfofInfo
=newFileInfo(fName);
InBlock.gif
floatfSize=(float)fInfo.Length/(1024*1024);
InBlock.gif
this.axMediaPlayer1.FileName=fName;
InBlock.gif
this.axMediaPlayer1.Stop();
InBlock.gif
stringauthor=this.axMediaPlayer1.GetMediaInfoString(MediaPlayer.MPMediaInfoType.mpClipAuthor);
InBlock.gif
stringshortFileName=fName.Substring(fName.LastIndexOf("//")+1);
InBlock.gifshortFileName
=shortFileName.Substring(0,shortFileName.Length-4);
ExpandedSubBlockStart.gifContractedSubBlock.gif
string[]subItem=dot.gif{shortFileName,author,fSize.ToString().Substring(0,4)+"M",fName};
InBlock.gifListViewItemitem
=newListViewItem(subItem);
InBlock.gif
this.listView1.Items.Add(item);
InBlock.gif
this.listView1.Items[0].Selected=true;
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnPlay_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.listView1.Items.Count>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.listView1.SelectedItems.Count>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
intpos=this.listView1.SelectedItems[0].Index;
InBlock.gif
stringfName=this.listView1.Items[pos].SubItems[3].Text;
InBlock.gif
this.axMediaPlayer1.FileName=fName;
InBlock.gif
this.axMediaPlayer1.Play();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"ÇëÑ¡ÔñÒª²¥•ÅµÄ¸èÇú!!!","ÐÅÏ¢Ìáʾ",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnPause_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.axMediaPlayer1.FileName.Length>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMediaPlayer1.Pause();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择要播放的歌曲!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnStop_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.axMediaPlayer1.FileName.Length>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.axMediaPlayer1.Stop();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择要播放的歌曲!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnLast_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.listView1.Items.Count>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.listView1.SelectedItems.Count>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
intpos=this.listView1.SelectedItems[0].Index;
InBlock.gif
if(pos>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.listView1.Items[pos-1].Selected=true;
InBlock.gif
stringfName=this.listView1.Items[pos-1].SubItems[3].Text;
InBlock.gif
this.axMediaPlayer1.FileName=fName;
InBlock.gif
this.axMediaPlayer1.Play();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"已经是第一首歌曲了!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择要播放的歌曲!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
ExpandedSubBlockEnd.gif}

InBlock.gif
ExpandedSubBlockEnd.gif}

InBlock.gif
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
privatevoidbtnNext_Click(objectsender,System.EventArgse)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.listView1.Items.Count>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
if(this.listView1.SelectedItems.Count>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
intpos=this.listView1.SelectedItems[0].Index;
InBlock.gif
if(pos<this.listView1.Items.Count-1)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
this.listView1.Items[pos+1].Selected=true;
InBlock.gif
stringfName=this.listView1.Items[pos+1].SubItems[3].Text;
InBlock.gif
this.axMediaPlayer1.FileName=fName;
InBlock.gif
this.axMediaPlayer1.Play();
ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"已经是最后一首歌曲了!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
else
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifMessageBox.Show(
this,"请选择要播放的歌曲!!!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
InBlock.gif
ExpandedSubBlockEnd.gif}

InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif}

None.gif
None.gif
None.gif
None.gif
None.gif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值