当前位置: 首页>>代码示例>>C#>>正文


C# System.Media.SoundPlayer.LoadAsync方法代码示例

本文整理汇总了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();
        }
开发者ID:Sander-Kastelein,项目名称:NHL-Racegame,代码行数:30,代码来源:Game.cs

示例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();
 }
开发者ID:jonmrodriguez,项目名称:cs247,代码行数:7,代码来源:CustomController2.cs

示例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";
        }
开发者ID:xneo123,项目名称:PictureLottery,代码行数:30,代码来源:Form1.cs

示例4: Chat

 static Chat()
 {
     sound = new SoundPlayer("Resources\\chat.wav");
       try
       {
     sound.LoadAsync();
       }
       catch { }
 }
开发者ID:sunoru,项目名称:PBO,代码行数:9,代码来源:Chat.xaml.cs

示例5: StartBattleVM

 static StartBattleVM()
 {
     sound = new SoundPlayer("Resources\\challenged.wav");
       try
       {
     sound.LoadAsync();
       }
       catch { }
 }
开发者ID:sunoru,项目名称:PBO,代码行数:9,代码来源:StartBattleVM.cs

示例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();
        }
开发者ID:pichiliani,项目名称:CoMusic,代码行数:11,代码来源:Form1_BKP.cs

示例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;
            }
        }
开发者ID:xneo123,项目名称:PictureLottery,代码行数:21,代码来源:Form1.cs


注:本文中的System.Media.SoundPlayer.LoadAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。