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); //音效檔的檔案位置 
}  
arrow
arrow
    文章標籤
    C# 音效
    全站熱搜

    西夏普 發表在 痞客邦 留言(0) 人氣()