标签:
主要用了Windows Media Player控件,设置不同的属性值来实现它的播放,暂停,快进,快退等功能。
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace 播放器 { public partial class FrmMPlayer : Form { public FrmMPlayer() { InitializeComponent(); } private void FrmMPlayer_Load(object sender, EventArgs e) { tkbVolumne.Value = 5; AxMPlayer.settings.volume = tkbVolumne.Value; AxMPlayer.uiMode = "None"; } public string name; //打开的单击事件 private void BtnOpenFile_Click(object sender, EventArgs e) { string fname; OpenFileDialog dlgopen = new OpenFileDialog(); dlgopen.Filter = "MP3(*.MP3)|*.MP3"; if (dlgopen.ShowDialog() == DialogResult.OK) { fname = dlgopen.FileName; name = dlgopen.SafeFileName; AxMPlayer.URL = fname; } } //"播放"按钮 private void btnPlay_Click(object sender, EventArgs e) { AxMPlayer.Ctlcontrols.play(); } //"暂停"按钮 private void btnPause_Click(object sender, EventArgs e) { AxMPlayer.Ctlcontrols.pause(); tmPlayer.Enabled = false; } //"停止"按钮 private void btnStop_Click(object sender, EventArgs e) { AxMPlayer.Ctlcontrols.stop(); tmPlayer.Enabled = false; } //"快进"按钮 private void btnFastForward_Click(object sender, EventArgs e) { AxMPlayer.Ctlcontrols.fastForward(); } //"快退"按钮 private void btnFastReverse_Click(object sender, EventArgs e) { AxMPlayer.Ctlcontrols.fastReverse(); } //"全屏"按钮 private void btnFullScreen_Click(object sender, EventArgs e) { if (AxMPlayer.playState == WMPLib.WMPPlayState.wmppsPlaying) { AxMPlayer.fullScreen = true; AxMPlayer.uiMode = "Full"; } } //播放媒体发生变化时触发此事件 private void AxMPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e) { lblTotalTime.Text += AxMPlayer.currentMedia.duration; tmPlayer.Enabled = true ; lblSongName.Text = "歌名:" + name; } private void tmPlayer_Tick(object sender, EventArgs e) { lblEscapeTime.Text = "已经播放时间:" + AxMPlayer.Ctlcontrols.currentPosition + "秒"; } private void tkbVolumne_Scroll(object sender, EventArgs e) { AxMPlayer.settings.volume = tkbVolumne.Value; } //关闭按钮 private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); } } }
PSP | Personal Software Process Stages | Time(h) |
Planning | 计划 | 3 |
·Estimate | ·估计这个任务需要多少时间 | 6 |
Development | 开发 | 30 |
·Analysis | ·需求分析 | 4 |
·Design Spec | ·生成设计档案 | 13 |
·Design Review | ·设计复审 | 1 |
·Coding Standard | ·代码规范 | 1 |
·Design | ·具体设计 | 2 |
·Coding | ·具体编码 | 12 |
·Code Review | ·代码复审 | 2 |
·Test | ·测试 | 1 |
Reporting | 报告 | 2 |
·Test Report | ·测试报告 | 1 |
·Size Measurement | ·计算工作量 | 1 |
·Postmortem & Process Improvement Plan | ·事后总结,并提出过程改进计划 | 5 |
在做这个播放器的时候,我们感觉到我们知识面太窄了,有太多知识我们不知道,在这个程序中就有体现,因为我们没有学过Windows Media Player控件,对它的属性不太了解,所以在程序中“文件名:”“播放总时间”“已播放时间都没有获取到,我们会再试着把它做出来的。
程序的代码是规范的。
标签:
原文地址:http://www.cnblogs.com/snowz/p/4952648.html