C# 语音播报

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/WL2002200/article/details/53509809

添加引用

COM中添加Microsoft Speech Object Library

添加控件

在代码中添加 using SpeechLib;

简单代码实现

SpeechVoiceSpeakFlags flag= SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice voice = new SpVoice();
string voice_txt ="苟利国家生死以,岂因祸福避趋之";
voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);
voice.Speak(voice_txt, flag);
阅读更多
换一批

没有更多推荐了,返回首页