StateChangedEventArgs 类   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从 StateChanged 事件返回数据。
public ref class StateChangedEventArgs : EventArgs
	public class StateChangedEventArgs : EventArgs
	type StateChangedEventArgs = class
    inherit EventArgs
	Public Class StateChangedEventArgs
Inherits EventArgs
		- 继承
 
示例
以下示例演示了有关 StateChanged 事件的可用信息。
using System;  
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();  
        // Subscribe to StateChanged event.  
        synth.StateChanged += new EventHandler<StateChangedEventArgs>(synth_StateChanged);  
        // Subscribe to the SpeakProgress event.  
        synth.SpeakProgress += new EventHandler<SpeakProgressEventArgs>(synth_SpeakProgress);  
        // Speak the prompt.  
        synth.Speak("What is your favorite color?");  
        // Pause the SpeechSynthesizer object.  
        synth.Pause();  
        // Resume the SpeechSynthesizer object.  
        synth.Resume();  
      }  
      Console.WriteLine("\nPress any key to exit...");  
      Console.ReadKey();  
    }  
    // Write the state of the SpeechSynthesizer to the console.  
    static void synth_StateChanged(object sender, StateChangedEventArgs e)  
    {  
      Console.WriteLine("State: {0}    Previous State: {1}\n", e.State, e.PreviousState);  
    }  
    // Write the speak progress of the SpeechSynthesizer to the console.  
    static void synth_SpeakProgress(object sender, SpeakProgressEventArgs e)  
    {  
      Console.WriteLine(e.Text);  
    }  
  }  
}  
	注解
当 对象引发 事件时SpeechSynthesizer,会创建 的StateChanged实例StateChangedEventArgs。 若要获取新和上 SynthesizerState一个 的值,请在 事件的处理程序中访问 State 和 PreviousState 属性。
属性
| PreviousState | 
		 获取 SpeechSynthesizer 事件前的 StateChanged 的状态。  | 
        	
| State | 
		 获取 SpeechSynthesizer 事件前的 StateChanged 的状态。  | 
        	
方法
| Equals(Object) | 
		 确定指定对象是否等于当前对象。 (继承自 Object) | 
        	
| GetHashCode() | 
		 作为默认哈希函数。 (继承自 Object) | 
        	
| GetType() | 
		 获取当前实例的 Type。 (继承自 Object) | 
        	
| MemberwiseClone() | 
		 创建当前 Object 的浅表副本。 (继承自 Object) | 
        	
| ToString() | 
		 返回表示当前对象的字符串。 (继承自 Object) |