添加语音播报
项目添加下面的引用
public void tips(Label label)
{
SpeechSynthesizer s = new SpeechSynthesizer();//实例化
s.SpeakAsync(label4.Text);//播放的文本内容等于label4.text的内容
s.Pause();//暂停已开始的对象
s.Resume(); //恢复暂停后的对象
s.Rate = 0;//朗读频率
s.Volume = 100;//朗读音量
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = true;
timer1.Interval = 5000; //5秒
Facade.OrderListFaçade orderfacade = new Facade.OrderListFaçade();
Entity.T_OrderList order = new Entity.T_OrderList();
order.IsEnd = "未支付";
//未支付记录大于1条开始播报
List<Entity.T_OrderList> orderlist = orderfacade.selectIsEnd(order);
if (orderlist.Count >= 1)
{
tips(label4);
this.panel2.Left -= 5; //向右移动3个像素
if (this.panel2.Right < 0)
{
this.panel2.Left = this.Width; //panel控件左位置为当前控件宽度
}
}
}
标签:播报,语音,C#,label4,timer1,new,panel2,order
From: https://www.cnblogs.com/panjiewen/p/18030312