StateChangedEventArgs StateChangedEventArgs StateChangedEventArgs StateChangedEventArgs Class


StateChanged 事件傳回資料。Returns data from the StateChanged event.

public ref class StateChangedEventArgs : EventArgs
public class StateChangedEventArgs : EventArgs
type StateChangedEventArgs = class
    inherit EventArgs
Public Class StateChangedEventArgs
Inherits EventArgs


下列範例示範StateChanged事件可用的資訊。The following example demonstrates the information that is available about the StateChanged event.

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.   
        // 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.  
        // Resume the SpeechSynthesizer object.  
      Console.WriteLine("\nPress any key to exit...");  
    // 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)  


當物件引發StateChangedEventArgs 事件StateChanged時, 會建立的實例。 SpeechSynthesizerAn instance of StateChangedEventArgs is created when the SpeechSynthesizer object raises the StateChanged event. 若要取得新的和先前SynthesizerState的值, 請存取事件之處理常式中的StatePreviousState屬性。To obtain the values for the new and the previous SynthesizerState, access the State and PreviousState properties in the handler for the event.


PreviousState PreviousState PreviousState PreviousState

取得 SpeechSynthesizer 事件之前 StateChanged 的狀態。Gets the state of the SpeechSynthesizer before the StateChanged event.

State State State State

取得 SpeechSynthesizer 事件之前 StateChanged 的狀態。Gets the state of the SpeechSynthesizer before the StateChanged event.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)