SpeechSynthesizer.SelectVoice(String) 方法

定義

依名稱選取特定的語音。

public:
 void SelectVoice(System::String ^ name);
public void SelectVoice (string name);
member this.SelectVoice : string -> unit
Public Sub SelectVoice (name As String)

參數

name
String

要選取之語音的名稱。

備註

GetInstalledVoices使用 方法和 VoiceInfo 類別,取得您可以選取的已安裝文字轉語音 (TTS) 語音的名稱。 若要選取語音,請傳遞 屬性的整個內容做為 方法的 NameSelectVoice 引數。 物件 SpeechSynthesizer 會選取包含在語音 VoiceInfo.Name 屬性中的第一個已安裝語音 nameSpeechSynthesizer會執行區分大小寫的子字串比較,以判斷語音 name 是否符合 。

當應用程式呼叫 GetInstalledVoices 時,方法會確認它在登錄中找到的每個語音都符合特定最低準則。 對於驗證失敗的任何語音, GetInstalledVoices 將其 Enabled 屬性設定為 False 。 應用程式無法選取其屬性為 FalseEnabled 語音。 一般而言,應用程式不會設定語音的 Enabled 屬性。

若要依性別、年齡或地區設定選取語音,請使用其中 SelectVoiceByHints 一種方法。

適用於

另請參閱