Sub TreeALL()
Dim nodX As Node
Dim nodX2 As Node
Dim s As String
Dim i As Long
Dim xParent As Long
Dim xParent2 As Long
nMenu = 0
For Each obj In frmMain.Controls
If Left(obj.Name, 2) = "mn" Then
If Mid(obj.Name, 3, 1) = "0" Then menuName(nMenu) = Mid(obj.Name, 4, 10)
If Mid(obj.Name, 3, 1) = "1" Then menuName(nMenu) = Mid(obj.Name, 3, 10)
menuCaption(nMenu) = Replace(obj.Caption, "&", "")
menuCaption(nMenu) = obj.Name & ". " & SplitText(menuCaption(nMenu), ".", 2)
menuCaption(nMenu) = Replace(menuCaption(nMenu), "mn", "")
nMenu = nMenu + 1
End If
Next
For i = 0 To nMenu - 1
If Len(menuName(i)) = 1 Then
xParent = Left(menuName(i), 1)
Set nodX = treeview1.Nodes.Add(, , "mn" & xParent, menuCaption(i))
nodX.Checked = False
nodX.Expanded = True
ElseIf Len(menuName(i)) = 2 Then
xParent = Left(menuName(i), 2)
Set nodX = treeview1.Nodes.Add(, , "mn" & xParent, menuCaption(i))
nodX.Checked = False
nodX.Expanded = True
ElseIf Len(menuName(i)) > 2 And Len(menuName(i)) < 5 Then
Set nodX = treeview1.Nodes.Add("mn" & xParent, tvwChild, , menuCaption(i))
nodX.Checked = False
nodX.Expanded = True
ElseIf Len(menuName(i)) = 5 Then
Set nodX2 = treeview1.Nodes.Add(nodX, tvwChild, , menuCaption(i))
nodX2.Checked = False
nodX2.Expanded = True
End If
Next
treeview1.BorderStyle = vbFixedSingle
Call TreeBold
End Sub
Sub TreeGroup()
Dim i As Integer
Dim j As Integer
Dim xMenuGroup As String
Dim xMenuMaster As String
For i = 1 To Me.ListView1.ListItems.Count
xMenuGroup = Me.ListView1.ListItems.Item(i).ListSubItems(2).Text
For j = 1 To Me.treeview1.Nodes.Count
xMenuMaster = SplitText(Me.treeview1.Nodes.Item(j).Text, ".", 1)
If xMenuGroup = xMenuMaster Then Me.treeview1.Nodes.Item(j).Checked = True
Next
Next
End Sub
Sub TreeBold()
Dim i As Integer
For i = 1 To Me.treeview1.Nodes.Count
If Len(SplitText(Me.treeview1.Nodes(i).Text, ".", 1)) = 2 Then Me.treeview1.Nodes(i).Bold = True
Next
End Sub
VB Script - 1
02.55 |
Labels:
Programming
Langganan:
Posting Komentar (Atom)
0 comments:
Posting Komentar