1,451
社区成员
发帖
与我相关
我的任务
分享
Private Sub TreeView1_Click()
If Dir(App.Path & "\文件\" & Tree View1.Selected Item & ".rtf") = "" Then
Rich Text Box1(0).Text = ""
Else
Rich Text Box1(0).File Name = App.Path & "\文件\" & Tree View1.Selected Item & ".rtf"
End If
End Sub
Private Sub TreeView1_Click()
'树的节点被点击,激发事件进入该过程
If Dir(App.Path & "\文件\" & Tree View1.Selected Item & ".rtf") = "" Then
'在程序所在路径下的“文件”子目录里,如果不存在以树节点显示的文字为文件名 .rtf为扩展名的文件
Rich Text Box1(0).Text = ""
'那么textbox里显示空
Else
'否则(也就是相应的文件存在)
Rich Text Box1(0).File Name = App.Path & "\文件\" & Tree View1.Selected Item & ".rtf"
'richedit打开该文件进行显示
End If
End Sub