首先添加引用,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(); //釋放資源