在开发MicroERP时,开始只对权限作了很简单的分配.后来听了别人的建议,将权限修改成了可控制单据级别,并没有控制到铵钮.
开始用了这个树控件,使用起来确实方便,比如级联全选,现给出函数
‘Private Sub CheckChild(ByVal node As MSComctlLib.node, ByVal bCheck As Boolean, Optional ByVal bNext As Boolean = True, Optional ByVal bChild As Boolean = True)
‘ If Not node Is Nothing Then
‘ node.Checked = bCheck
‘
‘ If node.Children And bChild Then‘选中合适子了节点
‘ Call CheckChild(node.Child, bCheck, True, True)
‘ End If
‘
‘ If bNext Then
‘ Call CheckChild(node.Next, bCheck, True, bChild)
‘ End If
‘
‘ ‘父节点
‘
‘ If Not node.Parent Is Nothing Then
‘ If node.Parent.Index <> 1 Then
‘ node.Parent.Checked = True
‘ End If
‘ End If
‘ End If
‘End Sub
‘
‘
‘Private Sub tvType_NodeCheck(ByVal node As MSComctlLib.node)
‘ Call CheckChild(node, node.Checked, False, True)调用
‘End Sub
存储节点数据用了for each node了,存储后的数据是没错的,但调出数据再显示到treeview就出现问题了,子节点没有按预想的勾选.
查了查,居然是VB本身的BUG,微软给出的方式是调用API.