Private Sub ExplorerTree1_TreeDataChanged() On Error Resume
Next ExplorerList1.TreeDatas = ExplorerTree1.TreeDatas End
Sub
Private Sub
ExplorerList1_FolderClick() ExplorerTree1.FolderClick
(ExplorerList1.filename) End
Sub ②利用ExplorerTree的OnDirChanged
方法和Path属性,让Text1文本框显示目录的地址路径。
Private Sub ExplorerTree1_OnDirChanged() Text1.Text =
ExplorerTree1.Path End
Sub ③利用ExplorerList的GetFileName
方法和filename属性,让Text2文本框显示在ExplorerList窗格中选定的文件。
Private Sub ExplorerList1_GetFileName() Text2.Text =
ExplorerList1.filename End
Sub ④编写代码完成"转到"按钮的功能。当点击"转到"按钮时,让ExplorerTree树型目录窗格转到"地址"栏中输入的地址目录。
Private Sub Command1_Click() ExplorerTree1.BrowseFrom =
Text1.Text End
Sub (五)模仿Windows右键的查看菜单。
Private Sub Form_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single) If Button = vbRightButton
Then PopupMenu popmnu End If End
Sub 最后,编码以响应菜单事件
Private Sub mnuD_Click() ExplorerList1.View = 3 ’详细信息 End Sub
Private Sub mnuL_Click() ExplorerList1.View = 2 ’列表 End Sub
Private Sub mnuN_Click() ExplorerList1.View = 1 ’图标 End Sub
Private Sub mnuS_Click() ExplorerList1.View = 0 ’平铺 End
Sub