C# 我的图片的位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/116050/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 14:27:21  来源:igfitidea点击:

Location of My Pictures

提问by rudigrobler

How do I programatically (Using C#) find out what the path is of my My Pictures folder?

如何以编程方式(使用 C#)找出我的图片文件夹的路径?

Does this work on XP and Vista?

这适用于 XP 和 Vista 吗?

采纳答案by Andrew Grant

The following will return a full-path to the location of the users picture folder (Username\My Documents\My Pictures on XP, Username\Pictures on Vista)

以下将返回用户图片文件夹位置的完整路径(XP 上为 Username\My Documents\My Pictures,Vista 上为 Username\Pictures)

Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);

回答by dbrien

Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);

Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);

回答by Eduardo Campa?ó

Using Microsoft.VisualBasic.FileIO.SpecialDirectories.MyPictures you can get that, works in vista and XP.

使用 Microsoft.VisualBasic.FileIO.SpecialDirectories.MyPictures 你可以得到它,在 vista 和 XP 中工作。