C#在后台播放声音 [英] C# Playing a sound in the background

查看:79
本文介绍了C#在后台播放声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    private System.Media.SoundPlayer sp;
    public Form1()
    {
        InitializeComponent();
        sp = new System.Media.SoundPlayer(Properties.Resources.main);
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        sp.Play();
    }

主要是来自资源的MP3 ...我得到以下错误:* System.Media.SoundPlayer.SoundPlayer(System.IO.Stream)'的最佳重载方法匹配具有一些无效参数

main is a MP3 from resources...I get the following errors: *The best overloaded method match for System.Media.SoundPlayer.SoundPlayer(System.IO.Stream)' has some invalid arguments

*无法从"byte []"转换为"System.IO.Stream"

*cannot convert from 'byte[]' to 'System.IO.Stream'

推荐答案

Microsoft对此做了很好的教程!

Microsoft do a great tutorial on this!

请参阅: http://msdn.microsoft.com/zh-CN/library/windows/desktop/dd562692(v=vs.85).aspx

祝你好运.

这篇关于C#在后台播放声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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