https://files.cnblogs.com/Fooo/Net-数字语音wav.rar
https://files.cnblogs.com/Fooo/wav.rar
///////////***************************
using System.Media;
SoundPlayer win;
public Form1()
{
InitializeComponent();
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
win = null;
int keyAscii = (int)e.KeyChar;
this.label1.Text = keyAscii.ToString();
switch (keyAscii)
{
//win = new SoundPlayer(Application.StartupPath + @"\2.wav"); //相对路径写法
case 48:
win=new SoundPlayer(Properties.Resources._0);
break;
case 49:
win = new SoundPlayer(Properties.Resources._1);
break;
case 50:
win = new SoundPlayer(Properties.Resources._2);
break;
case 51:
win = new SoundPlayer(Properties.Resources._3);
break;
case 52:
win = new SoundPlayer(Properties.Resources._4);
break;
case 53:
win = new SoundPlayer(Properties.Resources._5);
break;
case 54:
win = new SoundPlayer(Properties.Resources._6);
break;
case 55:
win = new SoundPlayer(Properties.Resources._7);
break;
case 56:
win = new SoundPlayer(Properties.Resources._8);
break;
case 57:
win = new SoundPlayer(Properties.Resources._9);
break;
default:
break;
}
if (win != null)
win.Play();
}