在C:\Program Files\Common Files\Microsoft Shared\Speech文件夹内找到sapi.dll文件,添加的引用

 try
            {
                SpeechVoiceSpeakFlags spFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
                SpVoice voice = new SpVoice();
                if (this.richTextBox1.Text.Trim() == string.Empty)
                {
                    voice.Speak("请输入数据!", spFlags);
                }
                else
               {
                    voice.Speak(this.richTextBox1.Text, spFlags);
                }
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message);
            }

posted on 2009-02-20 14:35  wn323225  阅读(303)  评论(0)    收藏  举报