天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

53 lines
1.6 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SpeechLib;
namespace Stone.WinModuleTransWare
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void Speek(string txt)
{
try
{
SpVoice m_spVoice = new SpVoice();
m_spVoice.Volume = 100;
m_spVoice.Rate = 0;
m_spVoice.Speak(txt, SpeechVoiceSpeakFlags.SVSFlagsAsync);//开始
//SpeechRecognitionEngine recEngine = new SpeechRecognitionEngine();
//SpeechSynthesizer speech = new SpeechSynthesizer();
//speech.Rate = 0;//速度
//speech.Volume = 100;//音量,0-100
//speech.SpeakAsync("欢迎使用电力安全工器具集约化智能管控系统");//异步播放
//Thread.Sleep(2000);
//speech.SpeakAsyncCancelAll();//停止前面的所有播放
//speech.SpeakAsync("中华人民共和国");//异步播放,但是要等到前面的发音完成后才会播放该发音
//speech.Speak("欢迎使用电力安全工器具集约化智能管控系统");
//speech.Speak("中华人民共和国");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
private void button1_Click(object sender, EventArgs e)
{
Speek(textBox1.Text);
}
}
}