17-10-12, 05:32 PM
كاتب الموضوع : AhmedEssawy
اولا يجب اضافه Microsoft Speech Object Library من Add Referenceكود :
using System;
using System.Windows.Forms;
// You need this so you can use functions from the SAPI
using SpeechLib;
namespace SAPI
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Creates a new instance of SpVoice
SpVoice voice = new SpVoice();
// Tells the program to speak everything in the textbox using Default settings
voice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFDefault);
}
}
}