SpeakProgressEventArgs.Text Własność
Definicja
Ważny
Niektóre informacje dotyczą produktów przedpremierowych, które mogą zostać znacznie zmodyfikowane przed premierą. Microsoft nie udziela żadnych gwarancji, ani wyraźnych, ani domniemanych, dotyczących informacji podanych tutaj.
Tekst, który został właśnie wypowiedziany, gdy zdarzenie zostało podniesione.
public:
property System::String ^ Text { System::String ^ get(); };
public string Text { get; }
member this.Text : string
Public ReadOnly Property Text As String
Wartość nieruchomości
Zwraca tekst, który został właśnie wypowiedziany podczas wywoływania zdarzenia.
Przykłady
W poniższym przykładzie pokazano, jak SpeakProgress zdarzenie zgłasza CharacterPosition właściwości i Text dla ciągów zawierających liczby.
using System;
using System.Xml;
using System.IO;
using System.Speech.Synthesis;
namespace SampleSynthesis
{
class Program
{
static void Main(string[] args)
{
// Initialize a new instance of the SpeechSynthesizer.
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Configure the audio output.
synth.SetOutputToDefaultAudioDevice();
// Create an XML Reader from the file, create a PromptBuilder and
// append the XmlReader.
PromptBuilder builder = new PromptBuilder();
builder.AppendText("4003");
// Add a handler for the SpeakProgress event.
synth.SpeakProgress +=
new EventHandler<SpeakProgressEventArgs>(synth_SpeakProgress);
// Speak the prompt and play back the output file.
synth.Speak(builder);
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
// Write each word and its character position to the console.
static void synth_SpeakProgress(object sender, SpeakProgressEventArgs e)
{
Console.WriteLine("Speak progress - Character position: {0} Text: {1}",
e.CharacterPosition, e.Text);
}
}
}
Uwagi
Normalizuje SpeechSynthesizer liczby do słów, które odpowiadają sposobie mówienia liczby. Na przykład syntetyzator mówi liczbę "4003" jako "cztery tysiące trzech". SpeakProgress Wywołuje wydarzenie dla każdego z wypowiedzianych słów. Text Jednak właściwość dla każdego z trzech słów jest taka sama. Jest to tekst "4003" z monitu.