'''
''' 主菜单加载
'''
'''
Private Sub LoadMenuStrip()
For i = 0 To dt.Rows.Count - 1
If dt.Rows(i).Item("FRM_ID_LAST").Trim = "0" Then
’topMenuItem 主菜单
Dim topMenuItem As New ToolStripMenuItem
topMenuItem.Text = dt.Rows(i).Item("FRM_NAME_C").Trim
topMenuItem.Tag = dt.Rows(i).Item("FRM_ID").Trim
’主菜单添加
Me.mspMenu.Items.Add(topMenuItem)
’主菜单点击触发事件
AddHandler topMenuItem.Click, AddressOf mspMenuItem_Click ’委托
If dt.Rows(i).Item("ROOT_BUN").Trim <> "1" Then
’子菜单加载
LoadSubMenu(dt, topMenuItem, dt.Rows(i).Item("FRM_ID").Trim)
End If
End If
Next
End Sub
'''
''' 子菜单加载
'''
''' 记录集
''' 主菜单
''' id
'''
Private Sub LoadSubMenu(ByVal dtTable As DataTable, ByVal topMenuItem As ToolStripMenuItem, ByVal frmId As String)
Dim i As Integer
For i = 0 To dtTable.Rows.Count - 1
If dtTable.Rows(i).Item("FRM_ID").Trim <> "0" Then
If dtTable.Rows(i).Item("FRM_ID_LAST").Trim = frmId Then
’subMenuItem 子菜单
Dim subMenuItem As New ToolStripMenuItem
subMenuItem.Text = dtTable.Rows(i).Item("FRM_NAME_C").Trim
subMenuItem.Tag = dtTable.Rows(i).Item("FRM_ID").Trim
topMenuItem.DropDownItems.Add(subMenuItem)
’子菜单点击触发事件
AddHandler subMenuItem.Click, AddressOf mspMenuItem_Click
If dtTable.Rows(i).Item("ROOT_BUN").Trim <> "1" Then
LoadSubMenu(dtTable, subMenuItem, dtTable.Rows(i).Item("FRM_ID").Trim)
End If
End If
End If
Next
End Sub
Private Sub mspMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs)
For i = 0 To dt.Rows.Count - 1
If dt.Rows(i).Item("FRM_ID").Trim = sender.Tag Then
If dt.Rows(i).Item("ROOT_BUN").Trim = "1" Then
End If
End If
Next
End Sub