使用windows 窗体应用程序编写简单的阅读器
来源:互联网 发布:黄金交易软件手机版 编辑:程序博客网 时间:2024/05/22 16:42
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 Speech
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnRead_Click(object sender, EventArgs e)
{
Speak(txtContent.Text);
}
private void Speak(string speak)
{
SpVoice voice = new SpVoice();
voice.Rate = -4;
voice.Voice = voice.GetVoices(string.Empty,string.Empty).Item(0);
voice.Speak(speak, SpeechVoiceSpeakFlags.SVSFDefault);
}
//保存语音
private void btnSave_Click(object sender, EventArgs e)
{
try
{
SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice Voice = new SpVoice();
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav";
sfd.Title = "Save to a wave file";
sfd.FilterIndex = 2;
sfd.RestoreDirectory = true;
if (sfd.ShowDialog() == DialogResult.OK)
{
SpeechStreamFileMode SpFileMode = SpeechStreamFileMode.SSFMCreateForWrite;
SpFileStream SpFileStream = new SpFileStream();
SpFileStream.Open(sfd.FileName, SpFileMode, false);
Voice.AudioOutputStream = SpFileStream;
Voice.Speak(this.txtContent.Text, SpFlags);
Voice.WaitUntilDone(100);
SpFileStream.Close();
}
}
catch (Exception)
{
MessageBox.Show("An Error Occured!", "SpeechApp", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
0 0
- 使用windows 窗体应用程序编写简单的阅读器
- NET编写简单的Windows 服务应用程序
- C++/CLR 使用VS2015预览版编写Windows窗体应用程序(VS2012、VS2013类似)
- C++/CLR 使用(VS2012,VS2013,VS2015)编写Windows窗体应用程序
- C++/CLR 使用VS2015预览版编写Windows窗体应用程序(VS2012、VS2013类似)
- 使用 ClickOnce 部署 Windows 窗体应用程序
- 使用 ClickOnce 部署 Windows 窗体应用程序
- 使用 ClickOnce 部署 Windows 窗体应用程序
- 使用 ClickOnce 部署 Windows 窗体应用程序
- 使用 ClickOnce 部署 Windows 窗体应用程序
- 使用VS2010创建windows窗体应用程序
- VS2013 C++ /CLR WinForm 之一 编写 Windows窗体应用程序
- 基于桌面的Windows(窗体)应用程序
- windows应用程序窗体间的属性调用
- windows 应用程序 设置弹出式窗体的位置。
- C#开发Windows窗体应用程序的步骤
- C#开发Windows窗体应用程序的步骤
- .net framework 4.5 使用c++编写窗体(WinForm)应用程序
- DList双向链表
- Android性能优化
- 增加yum支持EPEL源
- intellij idea 注册服务器
- hibernate的方言
- 使用windows 窗体应用程序编写简单的阅读器
- Citrix 桌面虚拟化解决方案与VMware桌面虚拟化解决方案对比
- app跨域问题
- pdf文件怎么转换成word格式的文件
- Log4net入门使用
- eclipse tomcat ClassNotFoundException
- Face++ 人脸检测之POST[img](0)
- eclipse安装FreeMarker IDE
- linux下使用Scons构建自己的项目程序