using System;
using SystemCollectionsGeneric;
using SystemComponentModel;
using SystemData;
using SystemDrawing;
using SystemText;
using SystemWindowsForms;
using SystemMedia;
using SystemResources;
using SystemIO;
namespace SoundPlayerApp
{
public partial class Form : Form
{
private SoundPlayer simpleSound;
public Form()
{
InitializeComponent();
}
private void button_Click(object sender EventArgs e)
{
OpenFileDialog OpenFileDialog = new OpenFileDialog();
OpenFileDialogFilter = Wav文件(*wav)|*wav;
if (OpenFileDialogShowDialog() == DialogResultOK)
{
simpleSound = new SoundPlayer(OpenFileDialogFileName);
simpleSoundPlay();
}
}
private void button_Click(object sender EventArgs e)
{
OpenFileDialog OpenFileDialog = new OpenFileDialog();
OpenFileDialogFilter = Wav文件(*wav)|*wav;
if (OpenFileDialogShowDialog() == DialogResultOK)
{
simpleSound = new SoundPlayer(OpenFileDialogFileName);
simpleSoundPlayLooping();
}
}
private void button_Click(object sender EventArgs e)
{
if (simpleSound != null) simpleSoundStop();
}
private void button_Click(object sender EventArgs e)
{
simpleSound = new SoundPlayer(PropertiesResourcesbig);
simpleSoundPlay();
}
private void button_Click(object sender EventArgs e)
{
simpleSound = new SoundPlayer(PropertiesResourcesbig);
simpleSoundPlayLooping();
}
private void button_Click(object sender EventArgs e)
{
if (simpleSound != null) simpleSoundStop();
}
private void button_Click(object sender EventArgs e)
{
switch (comboBoxText)
{
case 星号(错误):
SystemSoundsAsteriskPlay();
break;
case 默认响声(叮当声):
SystemSoundsBeepPlay();
break;
case 感歎号(惊歎号):
SystemSoundsExclamationPlay();
break;
case 关键性停止(关键性终止):
SystemSoundsHandPlay();
break;
case 问题:
SystemSoundsQuestionPlay();
break;
}
}
private void button_Click(object sender EventArgs e)
{
ResourceManager rm = ResourceManagerCreateFileBasedResourceManager(SoundResource ApplicationStartupPath null);//资源文件不带扩展名称
byte[] buffer = (byte[])rmGetObject(Soundwav);
FileStream FS = new FileStream(Soundwav FileModeCreate);//新建文件
BinaryWriter BWriter = new BinaryWriter(FS);//以二进制打开文件流
BWriterWrite(buffer bufferLength);//从资源文件读取声音文件内容写入到一个声音文件中
BWriterClose();
FSClose();
simpleSound = new SoundPlayer(Soundwav);
simpleSoundPlay();
}
private void button_Click(object sender EventArgs e)
{
ResourceManager rm = ResourceManagerCreateFileBasedResourceManager(SoundResource ApplicationStartupPath null);//资源文件不带扩展名称
byte[] buffer = (byte[])rmGetObject(Soundwav);
FileStream FS = new FileStream(Soundwav FileModeCreate);//新建文件
BinaryWriter BWriter = new BinaryWriter(FS);//以二进制打开文件流
BWriterWrite(buffer bufferLength);//从资源文件读取声音文件内容写入到一个声音文件中
BWriterClose();
FSClose();
simpleSound = new SoundPlayer(Soundwav);
simpleSoundPlayLooping();
}
private void button_Click(object sender EventArgs e)
{
if (simpleSound != null) simpleSoundStop();
}
}
}