SpeechSynthesizer.BookmarkReached 事件   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
SpeechSynthesizer 在提示中遇到书签时引发。
public:
 event EventHandler<System::Speech::Synthesis::BookmarkReachedEventArgs ^> ^ BookmarkReached;
	public event EventHandler<System.Speech.Synthesis.BookmarkReachedEventArgs> BookmarkReached;
	member this.BookmarkReached : EventHandler<System.Speech.Synthesis.BookmarkReachedEventArgs> 
	Public Custom Event BookmarkReached As EventHandler(Of BookmarkReachedEventArgs) 
	事件类型
示例
以下示例创建一个包含两个书签的提示,并将输出发送到 WAV 文件进行播放。 当事件引发到控制台时, BookmarkReached 事件的处理程序会写入书签的名称及其在音频流中的位置。
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.SetOutputToWaveFile(@"C:\test\weather.wav");
        // Create a SoundPlayer instance to play the output audio file.
        System.Media.SoundPlayer m_SoundPlayer =
          new System.Media.SoundPlayer(@"C:\test\weather.wav");
        // Build a prompt and append bookmarks.
        PromptBuilder builder = new PromptBuilder(
          new System.Globalization.CultureInfo("en-US"));
        builder.AppendText(
          "The weather forecast for today is partly cloudy with some sun breaks.");
        builder.AppendBookmark("Daytime forecast");
        builder.AppendText(
          "Tonight's weather will be cloudy with a 30% chance of showers.");
        builder.AppendBookmark("Nighttime forecast");
        // Add a handler for the BookmarkReached event.
        synth.BookmarkReached +=
          new EventHandler<BookmarkReachedEventArgs>(synth_BookmarkReached);
        // Speak the prompt and play back the output file.
        synth.Speak(builder);
        m_SoundPlayer.Play();
      }
      Console.WriteLine();
      Console.WriteLine("Press any key to exit...");
      Console.ReadKey();
    }
    // Write the name and position of the bookmark to the console.
    static void synth_BookmarkReached(object sender, BookmarkReachedEventArgs e)
    {
      Console.WriteLine("Bookmark ({0}) reached at: {1} ",
        e.Bookmark, e.AudioPosition);
    }
  }
}
	注解
在 SpeechSynthesizer 处理任何 Speak、 SpeakAsync、 SpeakSsml或 SpeakSsmlAsync 方法时引发此事件。 有关与事件关联的数据的信息,请参阅 BookmarkReachedEventArgs。
可以使用 方法添加书签 AppendBookmark 。