利用System.Media来做声音提醒
呵呵,比如输错文字,提醒一下:)
using System.Media;
private void buttonBeep_Click(object sender, EventArgs e)
{
SystemSounds.Beep.Play();
}
private void buttonExclamation_Click(object sender, EventArgs e)
{
SystemSounds.Exclamation.Play();
}
private void buttonAsterisk_Click(object sender, EventArgs e)
{
SystemSounds.Asterisk.Play();
}
private void buttonQuestion_Click(object sender, EventArgs e)
{
SystemSounds.Question.Play();
}
private void buttonHand_Click(object sender, EventArgs e)
{
SystemSounds.Hand.Play();
}
本文介绍如何使用C#中的System.Media命名空间来实现简单的声音提醒功能。通过几个示例按钮触发预定义的声音效果,如嘟嘟声、惊叹号声等,适用于应用程序中错误提示或特殊事件的通知。
760

被折叠的 条评论
为什么被折叠?



