说明:
(1)支持Window 7系统,但是xp系统智能朗读英文和数字;
(2)添加引用 Interop.SpeechLib.dll;
(3)使用时调用StringToVoice(str)即可。
using SpeechLib;
/// <summary> /// 把字符串转换成声音 /// </summary> /// <param name="str">要朗读的字符串</param> public static void StringToVoice(string str) { if (str.Trim().Length > 0) { SpVoiceClass svc = new SpVoiceClass(); SpeechVoiceSpeakFlags spFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync; svc.Speak(str, spFlags); }图示:
(1)后台代码
(2)运行效果
原文地址:http://blog.csdn.net/u013816709/article/details/39521627