获取完系统当前日期后如何让它读出来?? winform 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 控件名.Text=DateTime.Now.Tostring();2楼已经说了,还不明白》》???非要写明才明白。。 难道lz是想要朗读出来? System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer(); synth.Speak(DateTime.Now.ToString());? http://blog.sina.com.cn/s/blog_6cf3e9940100pqq5.html就是语音开发吧,念出字符串,字符串自己组合分割出 ”现在时间是““点“”分“”秒“ 加进去项目添加引用:Microsoft Speech Object Libray下面这个例子可以播放指定音频文件,而且还可以读字符串:/// <summary> /// 播放声音文件 /// </summary> /// <param name="FileName">文件全名</param> public void PlaySound(string FileName) {//要加载COM组件:Microsoft speech object Library if (!System.IO.File.Exists(FileName)) { return; } SpeechLib.SpVoiceClass pp = new SpeechLib.SpVoiceClass(); SpeechLib.SpFileStreamClass spFs = new SpeechLib.SpFileStreamClass(); spFs.Open(FileName, SpeechLib.SpeechStreamFileMode.SSFMOpenForRead, true); SpeechLib.ISpeechBaseStream Istream = spFs as SpeechLib.ISpeechBaseStream; pp.SpeakStream(Istream, SpeechLib.SpeechVoiceSpeakFlags.SVSFIsFilename); spFs.Close(); } 使用Microsoft Speech SDK 5.1和语言包就可以从微软网站下载安装后,引用SpeechLib。选择哪个来读,需要查注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\ SpeechVoiceSpeakFlags SpFlags; SpVoice voice = null; //中文 private void SpeakChina(string speak) { voice = new SpVoice(); voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);//我的机器上0是MS-Lili-2052-20-DSK voice.Speak(speak, SpeechVoiceSpeakFlags.SVSFDefault); } speech 说我没引用 爆红线 speech 说我没引用 爆红线 speech 说我没引用 爆红线要添加System.Speech的引用 请问?在分析完成之前就遇到流结尾 help~给20分 字符串的截取 讨论一下c/s架构的多客户端数据同步问题 C#中有Application用法吗? 有没有办法得到任务栏,并且...看内容(高手救命) 关于打印的问题???? 我想加一个继承窗口,总是报错,怎么办? 谁能给我提供一个insider c#(电子版) 修改进程名 文本框获取数据库里所有的内容 给大家分享一个网站,全球第二好用JS美化http://istool.cn 好用请收藏,谢谢
2楼已经说了,还不明白》》???
非要写明才明白。。
System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();
synth.Speak(DateTime.Now.ToString());
?
就是语音开发吧,念出字符串,字符串自己组合分割出 ”现在时间是““点“”分“”秒“ 加进去
项目添加引用:Microsoft Speech Object Libray
下面这个例子可以播放指定音频文件,而且还可以读字符串:
/// <summary>
/// 播放声音文件
/// </summary>
/// <param name="FileName">文件全名</param>
public void PlaySound(string FileName)
{//要加载COM组件:Microsoft speech object Library
if (!System.IO.File.Exists(FileName))
{
return;
}
SpeechLib.SpVoiceClass pp = new SpeechLib.SpVoiceClass();
SpeechLib.SpFileStreamClass spFs = new SpeechLib.SpFileStreamClass();
spFs.Open(FileName, SpeechLib.SpeechStreamFileMode.SSFMOpenForRead, true);
SpeechLib.ISpeechBaseStream Istream = spFs as SpeechLib.ISpeechBaseStream;
pp.SpeakStream(Istream, SpeechLib.SpeechVoiceSpeakFlags.SVSFIsFilename);
spFs.Close();
}
从微软网站下载安装后,引用SpeechLib。选择哪个来读,需要查注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\
SpeechVoiceSpeakFlags SpFlags;
SpVoice voice = null; //中文
private void SpeakChina(string speak)
{
voice = new SpVoice();
voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);//我的机器上0是MS-Lili-2052-20-DSK
voice.Speak(speak, SpeechVoiceSpeakFlags.SVSFDefault);
}
要添加System.Speech的引用