【ALL】怎样才能发出“嘣”的一声? 怎样才能发出“嘣”的一声?这一声就是弹出messageBox 的那个错误音。但是不要出现MessageBox,只发出声音。怎么做到?我想要最简单的方法。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System.Runtime.InteropServices;[DllImport("user32.dll")]public static extern int MessageBeep(uint n); MessageBeep(0); [DllImport("user32.dll")]public static extern int MessageBeep(uint n); MessageBeep(0); Beep只能发出蜂鸣生。楼主说的那个得播放一个声音文件。你得先找到你要用的声音文件.System.Media.SoundPlayer snd = new SoundPlayer("YOUR_FILE_PATH");snd.Play(); 给大家听一段美妙的音乐:using System.Media;using System.Threading;namespace Test{ class MyClass { const int ti = 200; static void Main() { while(true) { SystemSounds.Asterisk.Play(); Thread.Sleep(ti); SystemSounds.Beep.Play(); Thread.Sleep(ti); SystemSounds.Exclamation.Play(); Thread.Sleep(ti); SystemSounds.Hand.Play(); Thread.Sleep(ti); SystemSounds.Question.Play(); Thread.Sleep(ti); } } }} Dictionary求教,KeyNotFound。 C#通过变成操作Word组件,自动生成Word文档的问题? winforms里弹出另存为对话框怎么实现 关于截取字符串 C#如何执行SQL Server 2K的一个命令insert? 想在每更新完一个Textbox内容的时候,都向DataRow对应的字段中保存数据,怎么做?-WinForm 一个关于拖放的问题 请教在vs2005中显示树控件的问题 如何把大文件写入到数据库的二进制字段中? C#在类中定义二维数组并初始化 C#.Net TreeView 重绘的问题 一个字段
using System.Runtime.InteropServices;[DllImport("user32.dll")]
public static extern int MessageBeep(uint n); MessageBeep(0);
public static extern int MessageBeep(uint n); MessageBeep(0);
System.Media.SoundPlayer snd = new SoundPlayer("YOUR_FILE_PATH");
snd.Play();
using System.Media;
using System.Threading;namespace Test
{
class MyClass
{
const int ti = 200;
static void Main()
{
while(true)
{
SystemSounds.Asterisk.Play();
Thread.Sleep(ti);
SystemSounds.Beep.Play();
Thread.Sleep(ti);
SystemSounds.Exclamation.Play();
Thread.Sleep(ti);
SystemSounds.Hand.Play();
Thread.Sleep(ti);
SystemSounds.Question.Play();
Thread.Sleep(ti);
}
}
}
}