以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助] 如何遍历窗口菜单所有项  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=116750)

--  作者:2900819580
--  发布时间:2018/3/30 13:46:00
--  [求助] 如何遍历窗口菜单所有项
    Dim itn() As String = {"主菜单","快捷菜单1","快捷菜单2","快捷菜单3","快捷菜单4","快捷菜单5"}

如果我有比较多的菜单。应该怎么获取,我现在是手动录入

--  作者:2900819580
--  发布时间:2018/3/30 14:09:00
--  
  For Each st As WinForm.Strip In e.Form.Strips

    For Each vit As WinForm.StripItem In st.Items

--  作者:有点甜
--  发布时间:2018/3/30 14:45:00
--  

http://www.foxtable.com/webhelp/scr/Strips.htm

 


--  作者:2900819580
--  发布时间:2018/10/9 14:49:00
--  
老师,如果有二级或三级函数,如何传递StripItem 

内部函数
Dim str As String
\'For Each st As WinForm.Strip In Forms(args(0)).Strips
For Each it As WinForm.StripItem In it.items
    If str > "" Then str &= "|"
    str &= it.Name
    If IT.Items.Count > 0 Then    Functions.Execute("遍历所有菜单",it)
Next
\'Next
Return str
窗口代码
Dim str As String
For Each st As WinForm.Strip In e.Form.Strips
    For Each it As WinForm.StripItem In st.Items
        If str > "" Then str &= "|"
        str &= it.Name
        If IT.Items.Count > 0 Then  str &=  Functions.Execute("遍历所有菜单",it)
    Next
Next
e.Sender.Text = str
str = Nothing

--  作者:有点甜
--  发布时间:2018/10/9 15:09:00
--  

Dim pit = args(0)
Dim ls = args(1)

For Each it As WinForm.StripItem In pit.items
    ls.add(it.Name)
    If it.items IsNot Nothing Then Functions.Execute("遍历所有菜单",it, ls)
Next

 

--------------

 

Dim ls As new List(Of String)
For Each st As WinForm.Strip In e.Form.Strips
    Functions.Execute("遍历所有菜单",st,ls)
Next
msgbox(String.Join("|", ls.ToArray))