Imports System.Speech.Synthesis
Public Class Form1
Private synth As SpeechSynthesizer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
synth = New SpeechSynthesizer()
TextBox1.Text = "你好,我的好朋友!QQ,abcd,1,2,3,4"
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim text As String = TextBox1.Text
' 设置朗读的语速和音量
synth.Rate = 6 ' 语速范围为-10到10,默认为0
synth.Volume = 100 ' 音量范围为0到100,默认为100
' 按照空格分割文本内容,逐个朗读
Dim words As String() = text.Split(" "c)
For Each word As String In words
synth.Speak(word)
Next
End Sub
End Class