首先添加引用,System.Speech
添加using指令:using System.Speech.Synthesis;
之后代码
SpeechSynthesizer synth = new SpeechSynthesizer();
synth.Rate = 1; //设置语速
synth.Speak(播报的内容);
synth.Dispose(); //释放资源
首先添加引用,System.Speech
添加using指令:using System.Speech.Synthesis;
之后代码
SpeechSynthesizer synth = new SpeechSynthesizer();
synth.Rate = 1; //设置语速
synth.Speak(播报的内容);
synth.Dispose(); //释放资源