示例#1
0
        /// <summary>
        /// 语音报警延迟线程
        /// </summary>
        /// <param name="text"></param>
        void SpeekText(string text)
        {
            SpeechLib.SpeechVoiceSpeakFlags SpFlags =

                SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync;

            SpeechLib.SpVoice Voice = new SpeechLib.SpVoice();


            try
            {
                Voice.Speak(text, SpFlags);
            }
            catch (Exception)
            {
                //报警
                //Voice.Speak("对不起语音系统发生故障", SpFlags);
                //MessageBox.Show(e.Message.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }

            thread.Join(5000);//阻塞线程5秒
        }
 private void btnOku_Click(object sender, EventArgs e)
 {
     SpeechLib.SpeechVoiceSpeakFlags flg = SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync;
     SpeechLib.SpVoice ses = new SpeechLib.SpVoice();
     ses.Speak(txtIng.Text);
 }