文件目录控制 [英] File directory control

查看:60
本文介绍了文件目录控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由众多控件组成的应用程序。其中一个控件BrowseFilesUsrCtrl.ascx在左侧显示树视图(显示目录中的所有文件夹/文件),右侧有一个预览窗格,显示某些文件的内容以供只读使用。已经提出了改变此屏幕的要求,因此它就像一个窗口浏览器会话,即左侧的树视图,仅显示文件夹项目,如果选择了文件夹,我想显示此文件夹中包含的任何文件的详细摘要。右侧窗格,即名称,大小,类型,日期修改后可以打开任何选定的文件来查看内容。



无需购买第三方控制有什么方法可以做到这一点?正确方向的推动将不胜感激。



谢谢

Hi, I have an application that is made up of numerous controls. One of these controls 'BrowseFilesUsrCtrl.ascx' displays with a treeview (displaying all folders/files on the directory) on the left hand side with a preview pane on the right which displays the contents of certain files for read only purposes. A requirement has been raised to alter this screen so it acts like a window explorer session i.e. treeview on the left that displays only folder items and if a folder is selected I'd like to show a detailed summary for any files contained in this folder in the right hand pane i.e. Name, Size, Type, Date Modified with the ability to open any selected file to view the contents.

Without the need to purchase a 3rd party control is there any way I can do this? A nudge in the right direction would be appreciated.

Thanks

推荐答案

你可以使用.NET Framework中的System.IO类。



单击左侧预览窗格中的目录名称后,使用 System.IO.FileInfo 类检索通过该文件找到的每个文件的详细信息 Directory.EnumerateFiles 方法。



您可以借鉴的一些例子:

EnumerateFiles()如何工作? [ ^ ]



如何使用DirectoryInfo.EnumerateFiles [ ^ ]



如何:枚举目录和文件 [ ^ ]



示例程序:

文件系统树视图 [ ^ ]
You can do it all using the System.IO Classes in the .NET Framework.

Upon click on directory name in the left preview pane, use System.IO.FileInfo class to retrieve details of each file found via the Directory.EnumerateFiles method.

Some examples that you can learn from:
How does EnumerateFiles() work?[^]

How to use DirectoryInfo.EnumerateFiles[^]

How to: Enumerate Directories and Files[^]

Sample Program:
File System Tree View[^]


这篇关于文件目录控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆