- #region 随着鼠标移动,语音提醒
- /// <summary>
- /// 参考代码:http://msdn.microsoft.com/en-us/library/system.threading.thread.aspx
- /// 线程部分的程序,做了修改.
- /// 用到上面的变量 static senderName来传递发送者的名字。
- /// </summary>
- /// <param name="sender"> as Image</param>
- /// <param name="e"></param>
- void myImage_ToolTipOpening(object sender, ToolTipEventArgs e)
- {
- senderName = (sender as Image).ToolTip.ToString();
- Thread tStopRead = new Thread(new ThreadStart(ThreadStopReadProc));
- tStopRead.Start();
- Thread tRead = new Thread(new ThreadStart(ThreadReadProc));
- tRead.Start();
- }
- public static void ThreadReadProc()
- {
- TextToSpeech.readString(senderName);
- }
- public static void ThreadStopReadProc()
- {
- TextToSpeech.stopRead();
- }
- #endregion
- //该片段来自于http://www.codesnippet.cn/detail/1507201513102.html
来源: http://www.codesnippet.cn/detail/1507201513102.html