vb中,一个按钮,两个文本框,点击按钮实现同时播放文本框内容
1条回答 默认 最新
- 「已注销」 2023-03-05 18:10关注
“Devil组”引证GPT后的撰写:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' 播放文本框1中的内容 My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Beep) My.Computer.Speech.Speak(TextBox1.Text) ' 播放文本框2中的内容 My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Beep) My.Computer.Speech.Speak(TextBox2.Text) End Sub在按钮的点击事件处理程序中使用了 My.Computer.Audio.PlaySystemSound 和 My.Computer.Speech.Speak 函数来播放文本框中的内容。PlaySystemSound 函数播放系统声音,Speak 函数将文本转换为语音并播放。首先播放了一个系统声音来提示用户,然后使用 Speak 函数播放文本框中的内容。
解决 无用评论 打赏 举报