学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

程序找错(从文字到语音,)

程序找错(从文字到语音,)

最近要做一个读取网页的程序.(从文字到语音),
下面我写的代码,引用了DoNetSpeech.dll.这个DLL是我们老师给我的.这程序能运行,但是不能读出webBrowser里面的内容,请指点.告诉我代码哪有错误.正确的应该是怎么样..拜托了.谢谢.  


using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Text;  
using System.Windows.Forms;  
using DoNetSpeech;  

namespace voice  
{  
    public partial class Form1 : Form  
    {  
        public static int Speakvoice;  
        SpeechVoiceSpeakFlags spFlags;  
        SpVoice voice;  
        public Form1()  
        {  
            InitializeComponent();  
            Speakvoice = 0;  
            spFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;  
            voice = new SpVoice();  
            voice.Voice = voice.GetVoices("", "").Item(0);  
            voice.Volume = 50;  
            voice.Rate = 5;  
        }  


        private void BackgroundProcess()  
        {  
            voice.Speak(string.Empty, SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);  
            voice.Volume = 50;  
            voice.Rate = 5;  
            voice.Voice = voice.GetVoices("", "").Item(0);  
            voice.Speak(webBrowser1.Text.ToString(), spFlags);  
        }  


        private void button1_Click(object sender, EventArgs e)  
        {  
            webBrowser1.Navigate(textBox1.Text.ToString());  
        }  

        private void button2_Click(object sender, EventArgs e)  
        {  
             BackgroundProcess();  
        }  
    }  
}

TOP

发新话题