共用方式為


HOW TO:將自訂位置加入至檔案對話方塊

更新:2007 年 11 月

Windows Vista 上的預設開啟和儲存對話方塊的左側,有名為 [我的最愛連結] 的區域。這塊區域稱為自訂位置。OpenFileDialogSaveFileDialog 類別能夠讓您將資料夾加入至 CustomPlaces 集合。

注意事項:

如果要讓自訂位置出現在 OpenFileDialogSaveFileDialog 中,AutoUpgradeEnabled 屬性必須設定為 true (預設值)。

將自訂位置加入至檔案對話方塊

  • 將路徑、已知資料夾 GUID 或 FileDialogCustomPlace 物件加入至對話方塊的 CustomPlaces 集合。

    下列程式碼範例示範如何加入路徑:

    OpenFileDialog1.CustomPlaces.Add("C:\MyCustomPlace")
    
    openFileDialog1.CustomPlaces.Add("C:\\MyCustomPlace");
    

請參閱

概念

檔案對話方塊自訂位置的已知資料夾 GUID

參考

FileDialog

FileDialogCustomPlacesCollection.Add

其他資源

FileDialog 類別