以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=63559)

--  作者:twlg
--  发布时间:2015/1/23 15:04:00
--  [求助]

我想借鉴甜老师的帮助下以及论坛例子完成的简单的菜单权限http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=59745&replyID=&skin=1

 

但是我的界面又是借助西瓜住持的界面。研究了半天,不知道该怎么样将循环读取 菜单设计、功能区的代码替换为循环读取全局代码。求帮助

 

目前读取菜单功能区、快速访问栏和配置栏的代码

 

Dim tv As WinForm.TreeView = e.Form.Controls("菜单权限")

tv.Nodes.Clear

tv.Nodes.Add("功能区")

For Each rtb As RibbonMenu.Tab In RibbonTabs

    If tv.Nodes("功能区").Nodes.Contains(rtb.Name) = False

        tv.Nodes("功能区").Nodes.Add(rtb.Name)

    End If

    For Each grp As RibbonMenu.Group In rtb.Groups

        If tv.Nodes("功能区").Nodes(rtb.Name).Nodes.Contains(grp.Name) = False Then

            tv.Nodes("功能区").Nodes(rtb.Name).Nodes.Add(grp.Name)

        End If

        For Each itm As RibbonMenu.RibbonItem In grp.Items

            If tv.Nodes("功能区").Nodes(rtb.Name).Nodes(grp.Name).Nodes.Contains(itm.Name) = False Then

                 tv.Nodes("功能区").Nodes(rtb.Name).Nodes(grp.Name).Nodes.Add(itm.Name)

            End If

        Next

    Next

Next

 

\'快速访问兰

Dim tv9 As WinForm.TreeView = e.Form.Controls("菜单权限")

tv9.Nodes.Add("快速访问栏")

For Each itm9 As object In QAT.Items

    Dim nd9 As object = tv9.Nodes("快速访问栏").Nodes.Add(itm9.Name)

    If itm9.Gettype.name <> "Button"   Then

       If  itm9.Gettype.name <> "Separator"  Then     

        For Each citm As object In itm9.items

             Dim cnd As object = nd9.Nodes.Add(citm.Name)

            If citm.Gettype.name <> "Button" Then  

                      If  citm.Gettype.name <> "Separator"  Then     

                For Each ccitm As RibbonMenu.RibbonItem In citm.items

                    Dim ccnd As object = cnd.Nodes.Add(ccitm.Name)

                Next

              End If

            End If   

        Next

     End If

    End If

Next

\'配置兰

tv9.Nodes.Add("配置栏")

For Each itm9 As object In ConfigBar.Items

    Dim nd9 As object = tv9.Nodes("配置栏").Nodes.Add(itm9.Name)

    If itm9.Gettype.name <> "Button"   Then

       If  itm9.Gettype.name <> "Separator"  Then     

        For Each citm As object In itm9.items

             Dim cnd As object = nd9.Nodes.Add(citm.Name)

            If citm.Gettype.name <> "Button" Then  

                      If  citm.Gettype.name <> "Separator"  Then      

                For Each ccitm As RibbonMenu.RibbonItem In citm.items

                    Dim ccnd As object = cnd.Nodes.Add(ccitm.Name)

                Next

              End If

            End If   

        Next

     End If

    End If

Next

\'Dim trv8 As WinForm.TreeView = e.Form.Controls("菜单权限")

For Each nd8 As WinForm.TreeNode In tv.AllNodes

    If nd8.Text.IndexOf("分割条") >= 0 Then

       nd8.Delete()

    End If

Next

 

e.Form.Controls("菜单权限").Enabled = False

 

  e.Form.Controls("Btn菜单授权保存").Enabled = False

  e.Form.Controls("Btn菜单授权清除").Enabled = False

  e.Form.Controls("Btn菜单授权编辑").Enabled = False

    e.Form.Controls("提示1").Text = "请选择用户!!!"

 

 

 

希望更换为全局代码内的代码

Public  ImageList As New System.Windows.Forms.ImageList()
Sub New
ImageList.ImageSize = New System.Drawing.Size(32, 32)
\'设置图标大小
\'设置图标库 供调用
ImageList.Images.Add(0, GetImage("全景菜单_基础资料维护_公司信息.png"))
ImageList.Images.Add(1, GetImage("全景菜单_基础资料维护_员工资料维护.png"))
ImageList.Images.Add(2, GetImage("全景菜单_基础资料维护_产品资料维护.png"))
ImageList.Images.Add(3, GetImage("全景菜单_基础资料维护_产品分类.png"))
ImageList.Images.Add(4, GetImage("全景菜单_基础资料维护_数据字典维护.png"))

ImageList.Images.Add(5, GetImage("全景菜单_行政管理_岗位职责维护.png"))
ImageList.Images.Add(6, GetImage("全景菜单_行政管理_刷卡记录.png"))
ImageList.Images.Add(7, GetImage("全景菜单_行政管理_考勤统计.png"))
ImageList.Images.Add(8, GetImage("全景菜单_行政管理_请假记录.png"))
ImageList.Images.Add(9, GetImage("全景菜单_行政管理_图书目录.png"))
ImageList.Images.Add(10, GetImage("全景菜单_行政管理_企业人才库.png"))
ImageList.Images.Add(11, GetImage("全景菜单_行政管理_办公用品采购申请.png"))
ImageList.Images.Add(12, GetImage("全景菜单_行政管理_工作报告.png"))

 

 


--  作者:有点甜
--  发布时间:2015/1/23 15:11:00
--  
 上传例子。
--  作者:twlg
--  发布时间:2015/1/24 11:13:00
--  

已改变方式解决了