Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,
I need solution for making current word high-lighted being read by SpeackAsync method.
Example:-Robin is a good boy.

in this if SpeakAsync reading at is then is should be highlight.

Plz look at given coding,,,,,,,

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Speech.Synthesis;
using System.IO;
namespace text_to_speech
{
    public partial class Form1 : Form
    {
        SpeechSynthesizer reader;
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            reader = new SpeechSynthesizer();
            btnPause.Enabled = false;
            btnResume.Enabled = false;
            btnStop.Enabled = false;
            xtxtContent.ScrollBars = ScrollBars.Both;
            
            volumebar.Maximum = 100;
            speedbar.Maximum = 10;
            speedbar.Minimum = -5;
            volumebar.Value = 50;
           
        }
        //SPEAK TEXT
        private void button1_Click(object sender, EventArgs e)
        {
            reader.Dispose();
            if (xtxtContent.Text != "")
            {
                reader = new SpeechSynthesizer();
                reader.Volume = volumebar.Value;
                reader.Rate = speedbar.Value;
                
                reader.SpeakAsync(xtxtContent.Text);
                label2.Text = "SPEAKING";
                btnPause.Enabled = true;
                btnStop.Enabled = true;
                reader.SpeakCompleted += new EventHandler<SpeakCompletedEventArgs>(reader_SpeakCompleted);
            }
            else
            {
                MessageBox.Show("Please enter some text in the textbox", "Message", MessageBoxButtons.OK);
            }
        }
        void reader_SpeakCompleted(object sender, SpeakCompletedEventArgs e)
        {
            label2.Text = "IDLE";
        }
[Edit]Code block added[/Edit]
Posted
Updated 2-Apr-13 21:26pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900