Windows Vista 上的默认打开和保存对话框在对话框左侧有一个标题为 “收藏夹链接”的区域。 此区域称为自定义位置。 使用 OpenFileDialog 和 SaveFileDialog 类可以将文件夹添加到 CustomPlaces 集合。
注释
要使自定义位置出现在OpenFileDialog或SaveFileDialog,必须将AutoUpgradeEnabled属性设置为true
(默认)。
向文件对话框添加自定义位置
将路径、已知文件夹 GUID 或 FileDialogCustomPlace 对象添加到 CustomPlaces 对话框的集合。
下面的代码示例演示如何添加路径:
OpenFileDialog1.CustomPlaces.Add("C:\MyCustomPlace")
openFileDialog1.CustomPlaces.Add("C:\\MyCustomPlace");