From a97c94597cfbf63f31c4adab7c2977ec881cb3e3 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Thu, 19 Apr 2018 14:32:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=A3=B0=E9=9F=B3=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=96=B9=E6=B3=95=E9=87=8D=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinFormControl/Utils/SoundPalyUtil.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/WinFormControl/Utils/SoundPalyUtil.cs b/WinFormControl/Utils/SoundPalyUtil.cs index 9d45b6f..833f3d5 100644 --- a/WinFormControl/Utils/SoundPalyUtil.cs +++ b/WinFormControl/Utils/SoundPalyUtil.cs @@ -20,6 +20,15 @@ namespace WinFormControl player.Load(); player.Play(); } + + public static void PlaySound(string filePath) + { + if (!File.Exists(filePath)) + return; + player.SoundLocation = filePath; + player.Load(); + player.Play(); + } } public enum SoundType