一个界面左边窗体是树型菜单,右边是另外的一个窗体
右边的窗体是用来显示点击左边的菜单项时显示的相应的菜单项所链接的窗体!!
比如说就像操作系统那样:
双击打开“我的电脑”然后点击“搜索”后面的“文件夹”后显现的那样的界面!!!(点击右边窗体的c盘,左边窗体显示c盘内容;点击右边窗体的e盘,左边窗体显示e盘内容)这样的用vb能不能实现啊!!!
高手请帮忙啊!!!
小弟我是新手,要完成一个课程设计,以前没用过vb
谢谢先!!!
6 个解决方案
#1
没有问题,左边用treeview控件,右边用listView控件就可以
#2
楼上的能给个代码例子吗???谢了先!!!
#3
部件里把Microsoft common dialog control 6.0(sp3)
和Microsoft windows common control 6.0(sp4)加上去就可以找到上面两个控件。
和Microsoft windows common control 6.0(sp4)加上去就可以找到上面两个控件。
#4
你用工程向导创建一个explorer模式的工程,就可以看到代码
#5
我也正在寻求这样的功能,期待高手的答复。
#6
先在系统中搜索一下盘符,如有3个盘,c,d,e
call fileconnection("c:", false)
call fileconnection("d:", false)
call fileconnection("e:", false)
strpath下用treeview1来显示文件和文件夹:(下面为一自定义的过程)
Public Sub fileconnection(strpath As String, flag As Boolean)
Dim fso As New FileSystemObject
Dim folder As folder
Dim node As node
Set folder = fso.GetFolder(strpath)
Dim f As File
Dim strkey As String
TreeView1.LineStyle = tvwRootLines
strkey = strpath
If flag Then
Else
Set node = TreeView1.Nodes.Add(, , strkey, folder.Path)
End If
Dim sf As folder
If folder.Files.Count > 0 Then
For Each f In folder.Files
TreeView1.Nodes.Add strkey, tvwChild, f.Path, f.Name
Next f
End If
If folder.SubFolders.Count > 0 Then
For Each sf In folder.SubFolders
TreeView1.Nodes.Add strkey, tvwChild, sf.Path, sf.Name
Call fileconnection(sf.Path, True)
Next sf
End If
Set f = Nothing
Set sf = Nothing
End Sub
点击treeview1中的某个node时在另一个窗体中显示问题要麻烦一些
call fileconnection("c:", false)
call fileconnection("d:", false)
call fileconnection("e:", false)
strpath下用treeview1来显示文件和文件夹:(下面为一自定义的过程)
Public Sub fileconnection(strpath As String, flag As Boolean)
Dim fso As New FileSystemObject
Dim folder As folder
Dim node As node
Set folder = fso.GetFolder(strpath)
Dim f As File
Dim strkey As String
TreeView1.LineStyle = tvwRootLines
strkey = strpath
If flag Then
Else
Set node = TreeView1.Nodes.Add(, , strkey, folder.Path)
End If
Dim sf As folder
If folder.Files.Count > 0 Then
For Each f In folder.Files
TreeView1.Nodes.Add strkey, tvwChild, f.Path, f.Name
Next f
End If
If folder.SubFolders.Count > 0 Then
For Each sf In folder.SubFolders
TreeView1.Nodes.Add strkey, tvwChild, sf.Path, sf.Name
Call fileconnection(sf.Path, True)
Next sf
End If
Set f = Nothing
Set sf = Nothing
End Sub
点击treeview1中的某个node时在另一个窗体中显示问题要麻烦一些
#1
没有问题,左边用treeview控件,右边用listView控件就可以
#2
楼上的能给个代码例子吗???谢了先!!!
#3
部件里把Microsoft common dialog control 6.0(sp3)
和Microsoft windows common control 6.0(sp4)加上去就可以找到上面两个控件。
和Microsoft windows common control 6.0(sp4)加上去就可以找到上面两个控件。
#4
你用工程向导创建一个explorer模式的工程,就可以看到代码
#5
我也正在寻求这样的功能,期待高手的答复。
#6
先在系统中搜索一下盘符,如有3个盘,c,d,e
call fileconnection("c:", false)
call fileconnection("d:", false)
call fileconnection("e:", false)
strpath下用treeview1来显示文件和文件夹:(下面为一自定义的过程)
Public Sub fileconnection(strpath As String, flag As Boolean)
Dim fso As New FileSystemObject
Dim folder As folder
Dim node As node
Set folder = fso.GetFolder(strpath)
Dim f As File
Dim strkey As String
TreeView1.LineStyle = tvwRootLines
strkey = strpath
If flag Then
Else
Set node = TreeView1.Nodes.Add(, , strkey, folder.Path)
End If
Dim sf As folder
If folder.Files.Count > 0 Then
For Each f In folder.Files
TreeView1.Nodes.Add strkey, tvwChild, f.Path, f.Name
Next f
End If
If folder.SubFolders.Count > 0 Then
For Each sf In folder.SubFolders
TreeView1.Nodes.Add strkey, tvwChild, sf.Path, sf.Name
Call fileconnection(sf.Path, True)
Next sf
End If
Set f = Nothing
Set sf = Nothing
End Sub
点击treeview1中的某个node时在另一个窗体中显示问题要麻烦一些
call fileconnection("c:", false)
call fileconnection("d:", false)
call fileconnection("e:", false)
strpath下用treeview1来显示文件和文件夹:(下面为一自定义的过程)
Public Sub fileconnection(strpath As String, flag As Boolean)
Dim fso As New FileSystemObject
Dim folder As folder
Dim node As node
Set folder = fso.GetFolder(strpath)
Dim f As File
Dim strkey As String
TreeView1.LineStyle = tvwRootLines
strkey = strpath
If flag Then
Else
Set node = TreeView1.Nodes.Add(, , strkey, folder.Path)
End If
Dim sf As folder
If folder.Files.Count > 0 Then
For Each f In folder.Files
TreeView1.Nodes.Add strkey, tvwChild, f.Path, f.Name
Next f
End If
If folder.SubFolders.Count > 0 Then
For Each sf In folder.SubFolders
TreeView1.Nodes.Add strkey, tvwChild, sf.Path, sf.Name
Call fileconnection(sf.Path, True)
Next sf
End If
Set f = Nothing
Set sf = Nothing
End Sub
点击treeview1中的某个node时在另一个窗体中显示问题要麻烦一些