playsound.cs
来自「C#制作的经典游戏:数字拼图 提供源代码参考」· CS 代码 · 共 28 行
CS
28 行
using System;
using System.Runtime.InteropServices;
namespace NumPuzzle
{
/// <summary>
/// PlaySound 的摘要说明。
/// </summary>
public class PlaySound
{
private const int SND_SYNC = 0x0;
private const int SND_ASYNC = 0x1;
private const int SND_NODEFAULT = 0x2;
private const int SND_LOOP = 0x8;
private const int SND_NOSTOP = 0x10;
public static void Play(string file)
{
int flags = SND_ASYNC | SND_NODEFAULT;
sndPlaySound(file,flags);
}
[DllImport("winmm.dll")]
private extern static int sndPlaySound(string file,int uFlags);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?