如何添加音乐 [英] How to add music

查看:88
本文介绍了如何添加音乐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将音乐曲目添加到表单中?我的项目中有10个表单.

How can I add a music track to my forms? I have 10 forms in my project.

推荐答案

您可以使用SoundPlayer类
首先,创建一个对象使用Load()函数加载(.wav)文件,并使用Play()或PlayLooping()播放& Stop()停止它.

如果您使用的是VB.Net,它会更简单&可以在一行代码中完成:
My.Computer.Audio.Play("C:\ xxx.wav",AudioPlayMode.Background)
You could use the SoundPlayer class
First, create an object & use the Load() function to load a (.wav) file and use either Play() or PlayLooping() to play & Stop() to stop it.

In case if you are using VB.Net, its much simpler & can be done in one line of code:
My.Computer.Audio.Play("C:\xxx.wav",AudioPlayMode.Background)


这篇关于如何添加音乐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆