winform语音提示
1 public static class voiceHelper 2 { 3 public static System.Speech.Synthesis.SpeechSynthesizer synth; 4 /// <summary> 5 /// 语音提示 6 /// </summary> 7 /// <param name="content">提示内容</param> 8 public static void SpeakAsync(string content) 9 { 10 Dispose(); 11 synth = new System.Speech.Synthesis.SpeechSynthesizer(); 12 synth.SpeakAsyncCancelAll(); 13 synth.SpeakAsync(content);//异步朗读 14 } 15 16 /// <summary> 17 /// 释放资源 18 /// </summary> 19 public static void Dispose() 20 { 21 if (synth != null) 22 { 23 synth.Dispose(); 24 } 25 26 } 27 }