private void btnStart_Click(object sender, EventArgs e) { if (btnStart.Text == "开始") { voice.SetVoice((SpeechLib.ISpObjectToken)voice.GetVoices("Name=" + cbxVoices.Text, string.Empty).Item(0)); voice.SetVolume((ushort)volBar.Value); voice.SetRate((ushort)speedBar.Value); voice.Speak(txtS.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync); btnStart.Text = "暂停"; } else if (btnStart.Text.Trim() == "暂停") { voice.Pause(); btnStart.Text = "继续"; } else { btnStart.Text = "暂停"; voice.Resume(); } }
public void Pause() { voice.Pause(); }