using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using SpeechLib; namespace TextToVoice { public partial class Form1 : Form { SpVoice voice = new SpVoice(); public Form1() { InitializeComponent(); } private void SpeakButton_Click(object sender, EventArgs e) { if (this.SpeakTextBox.Text.Length == 0) MessageBox.Show("Enter text"); else { voice.Speak(SpeakTextBox.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync); } } private void StopButton_Click(object sender, EventArgs e) { voice.Skip(SpeakTextBox.Text.ToString(), SpeakTextBox.Text.Length); } } }