允许用户在 C# WinForms 应用程序中选择文件/文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/992355/
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
Allow user to choose file/folder in C# WinForms app
提问by UnkwnTech
How can I user to choose a file or a folder from within my forms app?
Is there not a built in component for it?
用户如何从我的表单应用程序中选择文件或文件夹?
没有内置组件吗?
采纳答案by Jon Skeet
There are a few depending on exactly what you need to do:
有几个取决于您需要做什么:
回答by AKo
You can use CommonOpenFileDialog
by WindowsAPICodePack
package to select a file and dialog.IsFolderPicker = true
to enable folder selection
您可以CommonOpenFileDialog
按WindowsAPICodePack
包使用来选择文件并dialog.IsFolderPicker = true
启用文件夹选择