0
我正在開發一個Windows窗體應用程序。目前我正在爲Windows窗體應用程序的設置方面工作。在設置表單上,我可以切換我的應用程序的提示音。默認聲音代碼如下如何使用組合框更改我的Windows窗體應用程序的聲音文件?
public String defaultAlertTone = Path.GetDirectoryName(Application.ExecutablePath) + "\\Sounds\\applause-2.wav";
至於設置,我已經包括2個默認音調供用戶通過組合框進行選擇。對於組合框的代碼如下,
private void comboBoxSound_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBoxSound.SelectedIndex == 0)
{
ReportStatus("Alert tone changed to 'Beep(1)'!");
backgroundFormObject.getSetting().defaultAlertTone = Path.GetDirectoryName(Application.ExecutablePath) + "\\Sounds\\beep-1.wav";
}
else
{
ReportStatus("Alert tone changed to 'Beep(2)'!");
backgroundFormObject.getSetting().defaultAlertTone = Path.GetDirectoryName(Application.ExecutablePath) + "\\Sounds\\beep-2.wav";
}
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
Stream stream = File.Open(appPath + "\\setting.sd", FileMode.Create);
BinaryFormatter bFormatter = new BinaryFormatter();
bFormatter.Serialize(stream, backgroundFormObject.getSetting());
stream.Close();
}
爲什麼,每當我選擇另一色調,和我一起玩的聲音,效果還是一樣的原始提示音是掌聲。在我玩之前是否必須等待文件加載完成?