반응형
일단은 System.Speech를 참조 추가하다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Speech.Synthesis; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace TextToSpeech { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { SpeechSynthesizer speechSynth = new SpeechSynthesizer(); PromptBuilder builder = new PromptBuilder(); builder.ClearContent(); builder.AppendText(textBox1.Text); speechSynth.Speak(builder); } } } | cs |
실행화면
이건 소리로 출력되는거라 실행은 각자 자신의 윈도우에서 컴파일해보세요.
'프로그래밍 > C#' 카테고리의 다른 글
[C#]웹폰트를 윈도우폼에 적용해 보자 (1) | 2018.04.01 |
---|---|
[C#]그라디에이션 (0) | 2018.03.18 |
[C#] zip파일 생성 (0) | 2018.02.11 |
[C#]디렉토리 삭제 할려는데 지정된 디렉터리가 비어 있지 않습니다. 오류시 (0) | 2018.02.05 |
[C#]폼명(string)으로 화면 열기 (0) | 2018.01.31 |