您的位置:首页 > 编程语言 > C#

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();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: