| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 498 人关注过本帖
标题:请高手帮我看看,我做的 资源管理器那里有毛病?
只看楼主 加入收藏
qq545395360
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-12-10
收藏
 问题点数:0 回复次数:0 
请高手帮我看看,我做的 资源管理器那里有毛病?
请高手帮我看看,我做的资源管理器那里有毛病?为什么只能显示到磁盘 而不能显示下级文件夹,?Imports
Public Class frmexplorer
    Inherits System.Windows.Forms.Form
    Dim strcurrentpath As String
    Dim strcurrentfile As String
    Dim tvcurrentnode As TreeNode
    Dim copysourcefile As String, copyfilename As String
    Dim contextmenufocus As Integer
    Dim bmodify As Boolean = False
    Dim seditfilename As String
#Region "windows窗体设计生成器的代码"
#End Region
#Region "浏览磁盘、文件夹及文件的操作,熟悉常用空件"
    Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
        If e.Node.Text = "我的电脑" Then
            dispdriver(e.Node)
        Else : dispdriver(e.Node)
        End If
    End Sub
    Private Sub dispdriver(ByVal node As TreeNode)
        Dim drv As String
        Dim i As Integer
        If node.Nodes.Count = 0 Then
            For Each drv In Directory.GetLogicalDrives
                Dim tmpnode As New TreeNode
                TreeView1.SelectedNode = node
                Dim temnode As New TreeNode
                tmpnode.Text = drv.Substring(0, drv.Length)
                tmpnode.Text = drv
                tmpnode.Tag = drv
                tmpnode.ImageIndex = 1
                tmpnode.SelectedImageIndex = 1
                TreeView1.SelectedNode.Nodes.Add(tmpnode)
                TreeView1.SelectedNode.Nodes(i).EnsureVisible()
                i = i + i
            Next
        End If
    End Sub
    Private Sub dispdir(ByVal node As TreeNode)
        Try
            TreeView1.SelectedNode = node
            Dim directorypath As String = node.Tag.ToString()
            If directorypath.Substring(directorypath.Length - 1) <> "\" Then
                directorypath += "\"
            End If
            strcurrentpath = directorypath
            tvcurrentnode = TreeView1.SelectedNode
            Dim dir As String
            Dim i As Integer
            For Each dir In Directory.GetDirectories(directorypath)
                Dim tmpnode As New TreeNode
                tmpnode.Text = dir.Substring(dir.LastIndexOf("\") + 1)
                tmpnode.Tag() = dir
                tmpnode.ImageIndex = 2
                tmpnode.SelectedImageIndex = 3
                TreeView1.SelectedNode.Nodes.Add(tmpnode)
                TreeView1.SelectedNode.Nodes(i).EnsureVisible()
                i += 1
            Next
            ListView1.Update()
            dispfile(node)
        Catch ex As Exception
        End Try
    End Sub
    Private Sub dispfile(ByVal node As TreeNode)
        Dim directorypath As String = node.tag.tostring()
        If directorypath.Substring(directorypath - 1) <> "\" Then
            directorypath += "\"
        End If
        Try
            ListView1.Items.Clear()
            Dim tmpfile As String
            Dim lvitem As ListViewItem
            For Each tmpfile In Directory.GetFiles(directorypath)
                lvitem = New ListViewItem(Path.GetFileName(tmpfile))
                lvitem.SubItems.Add(File.GetLastAccessTime(tmpfile))
                ListView1.Items.Add(lvitem)
            Next
            ListView1.Update()
        Catch ex As Exception
        End Try
    End Sub
#End Region

搜索更多相关主题的帖子: 文件夹 设计 资源管理器 windows 生成器 
2011-12-10 20:35
快速回复:请高手帮我看看,我做的 资源管理器那里有毛病?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014817 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved