使用.NET4.0自带的类库中的SpeechSynthesizer,制作成一个语音朗读程序。即实现了输入文字朗读的功能。
首先引入:using System.Speech.Synthesis;
前台源代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TextToVoice.aspx.cs" Inherits="TextToVoice" Async="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="92px"></asp:TextBox><br />
<asp:Button ID="Button1" runat