winform语音提示

 1   public static class voiceHelper
 2     {
 3         public static System.Speech.Synthesis.SpeechSynthesizer synth;
 4         /// 
 5         /// 语音提示
 6         /// 
 7         /// 提示内容
 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         /// 
17         /// 释放资源
18         /// 
19         public static void Dispose()
20         {
21             if (synth != null)
22             {
23                 synth.Dispose();
24             }
25 
26         }
27     }

 

转载于:https://www.cnblogs.com/junhuang/p/6369169.html

你可能感兴趣的:(winform语音提示)