第一范文网 - 专业文章范例文档资料分享平台

音乐播放器毕业论文

来源:用户分享 时间:2025/5/31 6:03:38 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

淮阴师范学院毕业论文(设计)

private void myListBox_MouseDown(object sender, MouseEventArgs e) {

if (this.myListBox.thisIndex != -1) {

if (e.Button == System.Windows.Forms.MouseButtons.Right) {

this.myListBox.ContextMenuStrip = this.cmsListBox; } } }

图5-2播放列表

5.3 播放控制模块

播放是音乐播放器最重要的功能。本程序使用Windows Media Player命名空间中定义的属性和方法来实现歌曲的播放、暂停、上下去切换等。其核心代码如下: private void initialBtn()

{

if (playStatue == MediaPlayer.PlayStatue.播放)

- 20 -

淮阴师范学院毕业论文(设计)

{ //正在播放,暂停图片

btnPlay.Image = Image.FromFile(\); }

else if (playStatue == MediaPlayer.PlayStatue.暂停 || playStatue == MediaPlayer.PlayStatue.停止) {//开始播放图片

btnPlay.Image = Image.FromFile(\); }

if (this.boolVolumn) {

this.btnVolumn.Image = Image.FromFile(\); } else

this.btnVolumn.Image = Image.FromFile(\);

}

private void nextSongPlay() {

//下一曲

if (playStyle == MediaPlayer.PlayStyle.随机播放)

{//选择随机播放时就产生一个随机数组,播放记录,根据数组,上一曲下一曲都有用

if (randomIndex + 1 >= randomList.Count) {

randomSongPlay(); } else

this.myListBox.doubleClickIndex = (int)randomList[++randomIndex];

}

else if (playStyle == MediaPlayer.PlayStyle.顺序播放) {

this.myListBox.doubleClickIndex++; if (this.myListBox.doubleClickIndex >= this.myListBox.Items.Count) {

playStatue = MediaPlayer.PlayStatue.停止; this.myListBox.doubleClickIndex = this.myListBox.Items.Count - 1;

- 21 -

淮阴师范学院毕业论文(设计)

stop();

initialBtn(); return; } } else

{//下一曲,如果到底,将播放第一首歌曲,全部循环 this.myListBox.doubleClickIndex++; if (this.myListBox.doubleClickIndex >= this.myListBox.Items.Count)

{//转第一首

this.myListBox.doubleClickIndex = 0; } }

btnChangeSong(); initialBtn();

}

private void lastSongPlay() {

if (playStyle == MediaPlayer.PlayStyle.随机播放 && randomIndex >= 1) {

this.myListBox.doubleClickIndex = (int)randomList[--randomIndex]; }

else if (playStyle == MediaPlayer.PlayStyle.顺序播放) {

this.myListBox.doubleClickIndex--;

if (this.myListBox.doubleClickIndex <= -1) {

this.myListBox.doubleClickIndex = 0;

playStatue = MediaPlayer.PlayStatue.停止; stop();

initialBtn(); return; } } else {

- 22 -

淮阴师范学院毕业论文(设计)

this.myListBox.doubleClickIndex--;

if (this.myListBox.doubleClickIndex <= -1) {//转最后一首

this.myListBox.doubleClickIndex = this.myListBox.Items.Count - 1; } }

btnChangeSong(); }

5.4 音量控制模块

通过调节音量大小来达到歌曲播放的最佳状态。可以调用API函数 SENDMESSAGE APPCOMMAND_VOLUME_MUTE和TrackBar 类来实现音量控制。代码如下: private void btnVolumn_Click(object sender, EventArgs e) {

IniUtility.FilePath = Application.StartupPath + \; if (this.boolVolumn) {

player.setAudioOnOff(\); this.boolVolumn = false;

IniUtility.WriteIniKey(\, \, \); } else {

player.setAudioOnOff(\); this.boolVolumn = true;

IniUtility.WriteIniKey(\, \, \); }

initialBtn(); }

private void myTBVolumn_Scroll(object sender, EventArgs e) {

- 23 -

搜索更多关于: 音乐播放器毕业论文 的文档
音乐播放器毕业论文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c7ul9y6xua085bn78adin_6.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top