添加引用System.Speech程序集(VS2012以后自带直接引用即可);
using System; using System.Speech.Synthesis; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { SpeechSynthesizer speech1= new SpeechSynthesizer(); string str = "你好"; speech1.Speak(str); //语音方法调用 } } }
时间: 2024-10-29 07:50:19