对于C#树视图/文件视图控制 [英] Tree View / File View Control for C#

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

问题描述

我一直在寻找一个C#树控件,用于显示具有以下功能的文件系统:

I have been looking for a C# tree control for displaying a file system that has the following capabilities:

  • 选择起始目录。我并不总是想开始一个默认最高一级目录。
  • 要抓住事件的能力时,在树的文件,用户双击。我想处理在我的应用程序中打开该文件。

我一直在寻找这 C#文件浏览器。不幸的是,我一直无法弄清楚如何做迎接我的第二个需要。 (如果有人可以清除了我,我想,即使是更好的。)感谢您的帮助。

I have been looking at this C# File Browser. Unfortunately, I have not been able to figure out how to do meet my second need. (If anybody can clear that up for me, I would like that even better.) Thanks for any help.

推荐答案

您好我已经看了C#文件浏览器,并找到一种方法来处理你的第二个要求。你可以尝试在文件查看器(下FileBrowser项目的浏览器用户控制)加入ItemActivate事件和处理时,它获得所选择的项目(S)。 ItemActivate事件被触发在每个双项的点击。下面是示例code:

Hi I've looked at the C# File Browser and Find a way to handle your 2nd requirement. You could try adding ItemActivate event on the fileView control (under Browser User Control of the FileBrowser project) and get the selected item(s) when handling it. ItemActivate event is triggered on every double click of an item. Here is the sample code:

private void fileView_ItemActivate(object sender, EventArgs e)
    {
        //Loop thru all selected items
        foreach (ListViewItem item in ((BrowserListView)sender).SelectedItems)
        {
            //Do your stuuf here. MessageBox is only used for demo
            MessageBox.Show(item.Text);
        }
    }

修改由原始的问题作家:要查看所有来源,看看code发表的 cipriansteclaru 在FileBrowser的评论部分。你有实际编辑FileBrowser源获得此功能(这是这个答案被证实)。

Edit by Original Question Writer: To see all of the source, look at the code posted by cipriansteclaru in the comments section of the FileBrowser. You have to actually edit the FileBrowser source to gain this functionality (which is what this answer was demonstrating).

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

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