如何在 C# 中使计算机发出哔哔声? [英] How can I make the computer beep in C#?
本文介绍了如何在 C# 中使计算机发出哔哔声?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在没有外部扬声器的情况下在 C# 中使计算机的内部扬声器发出哔哔声?
How do I make the computer's internal speaker beep in C# without external speakers?
推荐答案
在 .Net 2.0 中,您可以使用 Console.Beep().
In .Net 2.0, you can use Console.Beep().
// Default beep
Console.Beep();
您还可以以毫秒为单位指定蜂鸣声的频率和长度.
You can also specify the frequency and length of the beep in milliseconds.
// Beep at 5000 Hz for 1 second
Console.Beep(5000, 1000);
有关详细信息,请参阅 http://msdn.microsoft.com/en-us/library/8hftfeyw%28v=vs.110%29.aspx
For more information refer http://msdn.microsoft.com/en-us/library/8hftfeyw%28v=vs.110%29.aspx
这篇关于如何在 C# 中使计算机发出哔哔声?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文