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

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

        //浏览
        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);
        }


猜你喜欢

转载自blog.csdn.net/sinat_30224769/article/details/52028774