W/
C#
2019.02.28 21:30
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Media;
 
namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
                return;
            axWindowsMediaPlayer1.URL = openFileDialog1.FileName;
            axWindowsMediaPlayer1.uiMode = "none";
        }
 
        private void button2_Click(object sender, EventArgs e)
        {
            SoundPlayer Simple = new SoundPlayer();
            Simple.SoundLocation = "C:\\Windows\\Media\\Ding.wav";
            Simple.Play();
        }
 
        SoundPlayer player;
 
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            player = new SoundPlayer();
            player.SoundLocation = "horse1.wav";
            player.Play();
        }
 
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            player = new SoundPlayer();
            player.SoundLocation = "lion.wav";
            player.Play();
        }
 
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            player = new SoundPlayer();
            player.SoundLocation = "волк.wav";
            player.Play();
            player.PlayLooping();
 
        }
 
        private void button3_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
 
        private void button5_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
                return;
            player.SoundLocation = openFileDialog1.FileName;
            player.Play();
        }
 
        private void button4_Click(object sender, EventArgs e)
        {
            player.Stop();
 
        }
    }
}