我用c#代码写一个关于药店的系统,想实现当点击按钮时播放当前销售的总金额,该如何实现?谢谢

解决方案 »

  1.   

    参考:
    用.net编码实现朗读文本的方法
    http://www.comprg.com.cn/post_show.asp?id=1891Speech API还可以做到识别声音。
      

  2.   

    多少钱不是计算出来已经有了,判断如果几位数去组织声音,播放声音用System.Media.SoundPlayer就好了
      

  3.   

    自己录的数字读音会有尾音,中间有停顿,听起来会怪怪的,效果很不好,要用2楼的方法用TTS去读。
      

  4.   

    可是几位数该怎么判断呢?我曾试着用System.Media.Player写。把路径写死。可是数字大小和怎么读出来不会弄,我是个学生,不会写。还需要请教一下。希望能帮帮忙。
      

  5.   

    先在项目引用里添加 System.Speech.dll
    然后在文件头上加上:using System.Speech.Synthesis;
    然后在要播放声音的地方写:
         SpeechSynthesizer synth = new SpeechSynthesizer();
         synth.Speak("总金额, 12块8毛,请付钱");
    就这样。
      

  6.   

     [DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
            public static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);  mciSendString("Open " + 路径+ " alias wavType", null, 0, 0);
                mciSendString("Play wavType", null, 0, 0);