1.前言
為了增加程式的趣味性,我們在C#程式中也可以加入音效。
2.說明
舉例滑鼠進入label中觸發事件
using System.Runtime.InteropServices;
[DllImport("winmm.dll", EntryPoint = "sndPlaySoundA")]
public static extern long sndPlaySound(String SoundName, long Flags);
private void label1_MouseHover(object sender, EventArgs e)
{
sndPlaySound("sound\\po.wav", 1); //音效檔的檔案位置
}
文章標籤
全站熱搜
