c#朗读英文.txt
来自「实现朗读英文,让你更好的学习英文.他的发音很好.值得一用.」· 文本 代码 · 共 42 行
TXT
42 行
先在C盘下找到sapi.dll文件,添加的引用
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SpeechLib;
namespace WindowsApplication1
...{
public partial class Form1 : Form
...{
public Form1()
...{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
...{
try
...{
SpeechVoiceSpeakFlags spFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice voice = new SpVoice();
if (this.richTextBox1.Text.Trim() == string.Empty)
...{
voice.Speak("请输入数据!", spFlags);
}
else
...{
voice.Speak(this.richTextBox1.Text, spFlags);
}
}
catch (Exception Err)
...{
MessageBox.Show(Err.Message);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?