本文整理汇总了C#中System.Media.SoundPlayer.LoadAsync方法的典型用法代码示例。如果您正苦于以下问题:C# System.Media.SoundPlayer.LoadAsync方法的具体用法?C# System.Media.SoundPlayer.LoadAsync怎么用?C# System.Media.SoundPlayer.LoadAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Media.SoundPlayer
的用法示例。
在下文中一共展示了System.Media.SoundPlayer.LoadAsync方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Game
public Game()
{
InitializeComponent();
SetStyle(
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.DoubleBuffer |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint,
true
);
Image roadImage = Image.FromFile(Path.Combine(Environment.CurrentDirectory, "Racemap.bmp"));
BackgroundImage = Image.FromFile(Path.Combine(Environment.CurrentDirectory, "Racemapv3.bmp"));
roadBitmap = new Bitmap(roadImage);
//BackgroundImage = roadImage; //DEBUG
player = new System.Media.SoundPlayer();
player.SoundLocation = Path.Combine(Environment.CurrentDirectory, "music.wav");
player.LoadAsync();
nyanPlayer = new System.Media.SoundPlayer();
nyanPlayer.SoundLocation = Path.Combine(Environment.CurrentDirectory, "nyan.wav");
nyanPlayer.LoadAsync();
Paint += new PaintEventHandler(PaintHandler);
Init();
}
示例2: controllerActivated
public override void controllerActivated(Dictionary<int, Target> targets)
{
System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();
myPlayer.SoundLocation = @"C:\Users\jon\AppData\Local\Temp\Temp2_P3StarterCode.zip\P3StarterCode\coin.wav";
myPlayer.LoadAsync();
myPlayer.Play();
}
示例3: Start_Animals_Click
private void Start_Animals_Click(object sender, EventArgs e)
{
var strButton_Text=Start_Animals.Text;
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = "C:\\temp\\play.wav";
if (strButton_Text == "Start_Animals")
{
player.LoadAsync();
player.PlayLooping();
Start_Animals.Text = "Stop";
timer_animals.Enabled = true;
//listfile[j].Remove(0);
//animals.Image = Image.FromFile("c:\\temp\\dog.png");
//anim
//Timer timer = new Timer();
//timer.Interval = 500;
//timer.Enabled = true;
//timer.Start();
}
else
{
player.Stop();
Start_Animals.Text = "Start_Animals";
timer_animals.Enabled = false;
}
//
//animals.SizeMode = "StretchImage";
}
示例4: Chat
static Chat()
{
sound = new SoundPlayer("Resources\\chat.wav");
try
{
sound.LoadAsync();
}
catch { }
}
示例5: StartBattleVM
static StartBattleVM()
{
sound = new SoundPlayer("Resources\\challenged.wav");
try
{
sound.LoadAsync();
}
catch { }
}
示例6: Play
public void Play(string fname, int SoundFlags)
{
fname = "\\MP3\\PIANO\\" + fname;
fname = Application.StartupPath + fname;
//PlaySound(fname, 0, SoundFlags);
System.Media.SoundPlayer sound = new System.Media.SoundPlayer(fname);
sound.LoadAsync();
sound.Play();
}
示例7: Start_Colors_Click
private void Start_Colors_Click(object sender, EventArgs e)
{
var strButton_Text = Start_Colors.Text;
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = "C:\\temp\\play.wav";
if (strButton_Text == "Start_Colors")
{
player.LoadAsync();
player.PlayLooping();
Start_Colors.Text = "Stop";
timer_colors.Enabled = true;
}
else
{
player.Stop();
Start_Colors.Text = "Start_Colors";
timer_colors.Enabled = false;
}
}