导读部分
-------------------------------------------------------------------------------------------------------------
C#基类|C#自定义类|C#帮助类--系列导航文章
http://www.sufeinet.com/thread-655-1-1.html
[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Media;
using System.Windows.Forms;
namespace BaseFunction
{
/// <summary>
/// 系统声音类文件
/// </summary>
public class SystemMusic
{
//声音播放的类
public static SoundPlayer myplayer = new SoundPlayer();
/// <summary>
/// 播放音乐方法
/// </summary>
/// <param name="isFor">是否循环播放</param>
/// <param name="Path">音乐文件路径</param>
public static void PlayMusic(Boolean isFor, string Path)
{
myplayer.SoundLocation = Path;
if (isFor)
{
myplayer.PlayLooping();
}
else
{
myplayer.Play();
}
}
/// <summary>
/// 系统管理
/// </summary>
/// <param name="ifTrue">是否循环播放是为True否则为False</param>
public static void System_Management(Boolean isFor)
{
PlayMusic(isFor, @"\sound\系统设置.WAV");
}
/// <summary>
/// 删除
/// </summary>
/// <param name="ifTrue">是否循环播放是为True否则为False</param>
public static void Delete(Boolean isFor)
{
PlayMusic(isFor, @"\sound\删除.WAV");
}
}
}
|