C# 中添加聲音文件

我們在編寫C#程序的時候,想讓程序播放指定的聲音,可以用System.Media.SoundPlayer類來做,具體代碼如下: System.IO.FileStream fs = new System.IO.FileStream(“sound.wav”, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); System.Media.SoundPlayer sp = new System.Media.SoundPlayer(fs); sp.Play();
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章