记录小方法-获取文件路径Fileopen

来源:互联网 发布:深圳人工智能公司排名 编辑:程序博客网 时间:2024/06/08 14:30

保存一下获取文件的路径小方法

        //浏览        public string GetFilePath()        {            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();            openFileDialog.Title = "浏览";            openFileDialog.Filter = "(*.jpg,*.png,*.jpeg,*.bmp,*.gif)|*.jgp;*.png;*.jpeg;*.bmp;*.gif|All files(*.*)|*.*";            openFileDialog.FileName = string.Empty;            System.Windows.Forms.DialogResult result = openFileDialog.ShowDialog();            if (result == System.Windows.Forms.DialogResult.Cancel) return "";            return System.IO.Path.GetFullPath(openFileDialog.FileName);        }


0 0