using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
System.Media;
namespace
WindowsFormsApplication1
{
public partial
class Form1
: Form
{
SoundPlayer sound;
public Form1()
{
InitializeComponent();
sound = new
SoundPlayer();
}
private void
btnPlay_Click(object sender,
EventArgs e)
{
sound.Play();
}
private void
btnStop_Click(object sender,
EventArgs e)
{
sound.Stop();
}
private void
btnLoad_Click(object sender,
EventArgs e)
{
if (openFileDialog.ShowDialog()
== DialogResult.OK)
{
sound.SoundLocation =
openFileDialog.FileName;
}
}
}
} |