是否有可能作出的FolderBrowserDialog的默认路径显示在一个库,而不是实际的磁盘?有可能、磁盘、路径、而不是

2023-09-04 00:13:17 作者:南城旧少年

我知道,如果我设置 SelectedPath 之前,我显示对话框,我可以得到对话框打开时它有一个文件夹的默认打开。不过,我想使用的文件夹很远了名单按字母顺序排列。我有一个相同的文件夹我在Windows库之一,它出现在上市的,有没有办法把它默认的文件夹,而不是文件夹的硬盘版的库版本?

I know that if I set SelectedPath before I show the dialog I can get it to have a folder open by default when the dialog opens. However, the folder I want to use is very far down the list alphabetically. I have that same folder as one of my Libraries in Windows and it shows up at the of the listing, is there any way to have it default to the library version of the folder instead of the hard drive version of the folder?

另一种可能的解决办法是,如果它也仍然使用的驱动器版本,但它会自动滚动窗口到它被选中。有没有办法做到其中任何一个解决方案?

Another potential solution would be if it did still use the drive version but it automatically scrolled the window down to where it was selected. Is there any way to do either of these solutions?

目前,它如何显示出来。

How it currently shows up

我多么想它显示了

推荐答案

设置你的根文件夹并选择路径,例如,它会在对话开启自动滚动为您服务:

Set your root folder and selected path as such and it will auto-scroll there for you on the dialog opening:

FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.RootFolder = Environment.SpecialFolder.MyComputer;
dlg.SelectedPath = @"E:\Vetcentric";
dlg.ShowDialog();

您遇到的问题是,如果你看选择位于库层级的文件夹后的财产分配,它仍然将其分配到您将通过通过我的电脑拿到genereic路径。

The problem you run into is that if you watch the property assignments after selecting a folder located in the libraries hierarchy, it will still assign it to the genereic path that you would get via going through my computer.