以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  遍历菜单问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=71594)

--  作者:affixed
--  发布时间:2015/7/14 16:01:00
--  遍历菜单问题
For Each tab As RibbonMenu.Tab In RibbonTabs
    Output.Show(tab.Name)
    For Each grp As RibbonMenu.Group In RibbonTabs(tab.Name).Groups
        Output.Show("  " & grp.Name)
        For Each itm As RibbonMenu.RibbonItem In RibbonTabs(tab.Name).Groups(grp.Name).Items
            Output.Show("    " & itm.Name)
        Next
    Next
Next

上面的代码只能将菜单组中的按钮遍历出来,无法再对按钮进行判断,从而遍历出组合按钮下的各按钮了。
请问应该如何修改才能把组合按钮下的按钮也遍历出来呢?
[此贴子已经被作者于2015/7/14 16:01:36编辑过]

--  作者:大红袍
--  发布时间:2015/7/14 16:09:00
--  

 再加循环就行了

 

For Each tab As RibbonMenu.Tab In RibbonTabs
    Output.Show(tab.Name)
    For Each grp As RibbonMenu.Group In RibbonTabs(tab.Name).Groups
        Output.Show("  " & grp.Name)
        For Each itm As RibbonMenu.RibbonItem In RibbonTabs(tab.Name).Groups(grp.Name).Items
            Output.Show("    " & itm.Name)
            If itm.Gettype.name = "MenuButton" Then
                Dim temp As object = itm
                For Each i As Object In temp.Items
                    Output.Show("                  " & i.Name)
                Next
            End If
        Next
    Next
Next