Browse Source

修改代码

callm 6 years ago
parent
commit
8ff9ea558d

BIN
UAS-出货标签管理(标签复核)/NG.wav


BIN
UAS-出货标签管理(标签复核)/OK.wav


+ 21 - 0
UAS-出货标签管理(标签复核)/PublicMethod/BaseUtil.cs

@@ -9,6 +9,7 @@ using UAS_LabelMachine.CustomControl.GroupBoxWithBorder;
 using static System.Windows.Forms.Control;
 using System.Text.RegularExpressions;
 using System.Web.Script.Serialization;
+using System.Media;
 
 namespace UAS_LabelMachine
 {
@@ -40,6 +41,26 @@ namespace UAS_LabelMachine
             }
         }
 
+        public static void PlaySound(string FileName)
+        {
+            //要加载COM组件:Microsoft speech object Library    
+            if (!System.IO.File.Exists(FileName))
+            {
+                return;
+            }
+            try
+            {
+                SoundPlayer player = new SoundPlayer();
+                player.SoundLocation = FileName;
+                player.Load();
+                player.Play();
+            }
+            catch (Exception e)
+            {
+
+            }
+        }
+
         public static string DToAny(double DB, int Type)
         {
             string H = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";