c# 打开文件对话框
2016-08-30 10:04
190 查看
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "音乐播放选择";
ofd.InitialDirectory = @"F:\报警声音";
ofd.Multiselect = true;
ofd.Filter = "警报文件|*.wav| 所有文件|*.*";
ofd.ShowDialog();
string path = ofd.FileName;
System.Media.SoundPlayer sp = new System.Media.SoundPlayer();
sp.SoundLocation = System.IO.Path.GetFileName(path);
sp.Play();
ofd.Title = "音乐播放选择";
ofd.InitialDirectory = @"F:\报警声音";
ofd.Multiselect = true;
ofd.Filter = "警报文件|*.wav| 所有文件|*.*";
ofd.ShowDialog();
string path = ofd.FileName;
System.Media.SoundPlayer sp = new System.Media.SoundPlayer();
sp.SoundLocation = System.IO.Path.GetFileName(path);
sp.Play();
相关文章推荐
- C#打开文件对话框(OpenFileDialog)
- C# 打开Excel文件,总是弹出一个打印机设置的对话框 解决方案
- C#学习笔记(十六):使用打开保存文件对话框
- C#打开文件对话框
- C#打开指定路径文件对话框
- c# 自定义的打开文件对话框(源代码+示例)
- C#窗体程序怎么点击按钮打开一个选择文件的对话框
- C#按键打开文件选择对话框,并把选择好的路径保存/显示到textBox
- C#打开文件对话框和文件夹对话框
- C# 打开以对话框,获取文件夹路径 、文件的路径、文件名
- [C#]自定义的打开文件对话框(源代码+示例)
- C# 使用打开保存文件对话框
- C# 使用打开保存文件对话框
- C#实现同一个对话框打开目录和文件
- C#学习笔记(十六):使用打开保存文件对话框
- C#学习笔记(十六):使用打开保存文件对话框
- C# 打开以对话框,获取文件夹路径 、文件的路径、文件名
- 【C#学习笔记】打开对话框并返回打开文件所在路径
- c#打开对话框选择后输出文件路径文件名