SpeakProgressEventArgs.Text 屬性


正好在引發事件時所讀出的文字。The text that was just spoken when the event was raised.

 property System::String ^ Text { System::String ^ get(); };
public string Text { get; }
member this.Text : string
Public ReadOnly Property Text As String


傳回正好在引發事件時所讀出的文字。Returns the text that was just spoken when the event was raised.


下列範例說明SpeakProgress事件如何針對包含數位的字串CharacterPosition , Text報告和屬性。The following example illustrates the how the SpeakProgress event reports the CharacterPosition and Text properties for strings that contain numbers.

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.   
        // Create an XML Reader from the file, create a PromptBuilder and   
        // append the XmlReader.  
        PromptBuilder builder = new PromptBuilder();  
        // Add a handler for the SpeakProgress event.  
        synth.SpeakProgress +=  
          new EventHandler<SpeakProgressEventArgs>(synth_SpeakProgress);  
        // Speak the prompt and play back the output file.  
      Console.WriteLine("Press any key to exit...");  
    // 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);  


SpeechSynthesizer標準化的數位會對應到數位的讀出方式。The SpeechSynthesizer normalizes numbers to the words that correspond to how the number will be spoken. 例如, 合成器會將數位 "4003" 說為 "4003"。For example, the synthesizer speaks the number "4003" as "four thousand three". 它會針對SpeakProgress每個說出的單字引發事件。It raises a SpeakProgress event for each of the spoken words. 不過, Text這三個單字的屬性都相同。However, the Text property for each of the three words is the same. 這是提示字元中的文字 "4003"。It is the text "4003" from the prompt.