-6
var dlg = new Microsoft.Win32.OpenFileDialog();
dlg.Filter = "(*.JPG;*.GIF)|*.JPG;*.GIF";
dlg.ShowDialog();
if (string.IsNullOrEmpty(dlg.FileName)) return;
var fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read);
var data = new byte[fs.Length];
fs.Read(data, 0, System.Convert.ToInt32(fs.Length));
fs.Close()

我像这样浏览图片,但现在我也需要路径。

我怎样才能做到这一点?

4

1 回答 1

3

利用Path.GetDirectoryName(dlg.Filename)

于 2012-06-04T07:35:08.497 回答