[Mime] 在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"); }
}
}
上一篇:jquery 分页控件2


下一篇:【BZOJ】1012: [JSOI2008]最大数maxnumber /【洛谷】1198(线段树)