-- 作者:gaoyong30000
-- 发布时间:2012/3/26 14:39:00
-- [求助]【例子已上传】动态增加的 treeview6控件 如何定义起 nodemousedoubleclick事件和 afterexpandnode事件!
我在全局代码加入了处理这2个事件的代码
Public Sub treeview6_nodemousedoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Value() As String
Value = forms("ERP界面_table3").controls("treeview6").Node.FullPath.Split("\\")
Select Case forms("ERP界面_table3").controls("treeview6").Node.Level
Case 0
If forms("ERP界面_table3").controls("treeview6").node.text = "全部显示"
Tables("ERP界面_table3").Filter =""
Else
Tables("ERP界面_table3").Filter ="[部门] = \'" & Value(0) & "\'"
End If
Case 1
Tables("ERP界面_table3").Filter ="[部门] = \'" & Value(0) & "\' And [岗位] = \'" & Value(1) & "\'"
Case 2
Tables("ERP界面_table3").Filter ="[部门] = \'" & Value(0) & "\' And [岗位] = \'" & Value(1) &"\' And [责任人] = \'" & Value(2) & "\'"
End Select
End Sub
Public Sub treeview6_afterexpandnode(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim tr As WinForm.TreeView = forms("ERP界面_table3").Controls("TreeView6")
Dim nd As WinForm.TreeNode = tr.SelectedNode
If nd.Level = 0 Then
For Each pg As WinForm.TreeNode In tr.Nodes
If pg.Name <> nd.Name Then
pg.CollapseAll()
End If
Next
Else
For Each pg As WinForm.TreeNode In nd.Parentnode.nodes
If pg.Name <> nd.Name Then
pg.CollapseAll()
End If
Next
End If
End Sub
窗口afterload里
Dim trv As New Windows.Forms.treeview e.Form.Panel.Controls.Add(ct) AddHandler trv.nodemousedoubleclick, AddressOf treeview6_nodemousedoubleClick
结果出现
此主题相关图片如下:111111.jpg
请问什么情况~~~
[此贴子已经被作者于2012-3-27 21:09:36编辑过]
|