MainForm界面点击按钮读特定文字

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SpeechLib;

namespace WindowsFormsAppOne
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
            label1.Text = "欢迎入住!";
        }

        private void CheckInButton_Click(object sender, EventArgs e)
        {
            SpeechVoiceSpeakFlags flag = SpeechVoiceSpeakFlags.SVSFlagsAsync;
            SpVoice voice = new SpVoice();
            String voice_txt = label1.Text;
            voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);
            voice.Speak(voice_txt,flag);
        }
    }
}

如需转载,请注明出处!

猜你喜欢

转载自blog.csdn.net/weixin_43275982/article/details/82862024
今日推荐