【发布时间】:2010-02-17 18:01:18
【问题描述】:
这是来自 C# Windows 窗体的代码
SpeechSynthesizer audio = new SpeechSynthesizer();
audio.Speak(textBox1.Text);
- 这将读取文本框中的任何内容
尝试实现暂停和停止功能时出现问题。当代码读取某些内容时,任何按钮或菜单项都不会被点击
public void button1_Click(object sender, EventArgs e)
{
//Nothing gets executed here when the code is reading
}
我刚刚读到有 SpeakProgressEventArgs http://msdn.microsoft.com/en-us/library/system.speech.synthesis.speakprogresseventargs%28VS.85%29.aspx
我尝试了 synth...asyncancel...但是按钮的点击事件没有被执行
【问题讨论】:
-
SpeechSynthesizer 是否在 UI 线程中运行?如果它与 UI 事件循环在同一线程中运行,您的 UI 响应可能会很差。
标签: c# speechsynthesizer