先看看生成的菜单,前面多了2个东西一个空白的,一个tab,不知道哪里来的。此主题相关图片如下:111.png
代码用了很久了:
'菜单模块
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "s elect * from {菜单表}"
Dim dt As DataTable = cmd.ExecuteReader()
Dim drs As List(Of DataRow)
drs = dt.Select("[功能区] Like '*' and [是否启用] = 1 and 功能子项 is null ", "排序ID")
For Each dr As DataRow In drs
Dim tab As New RibbonMenu.Tab(dr("功能区"))
If Not RibbonTabs.Contains(dr("功能区")) Then
tab.Text = dr("功能区")
RibbonTabs.Add(tab)
End If
Next
For Each dr As DataRow In drs
Dim rg As New RibbonMenu.group(dr("功能组"))
If Not RibbonTabs(dr("功能区")).groups.Contains(dr("功能组")) Then
rg.Text = dr("功能组")
RibbonTabs(dr("功能区")).Groups.Add(rg)
End If
Next
For Each dr As DataRow In drs
If dr("项类型") = "RibbonMenu.Separator" Then
Dim rb As New RibbonMenu.Separator(dr("功能项"))
RibbonTabs(dr("功能区")).Groups(dr("功能组")).Items.Add(rb)
Else
Dim rb As New RibbonMenu.Button(dr("功能项"))
rb.Text = dr("功能项")
rb.LargeImage = GetImage(ProjectPath & "Images\" & dr("图标"))
rb.TextImageRelation = TextImageRelationEnum.ImageAboveText
RibbonTabs(dr("功能区")).Groups(dr("功能组")).Items.Add(rb)
End If
Next
菜单表
此主题相关图片如下:222.png
以下是引用有点蓝在2024/11/14 13:32:00的发言:
新版本是这样的。生成菜单前,先清空一下
RibbonTabs.Clear
--如果这样,在发布时,就不能勾选生成系统菜单,否则一直会报错,弹窗
左边的应该是:程序菜单 ,用代码隐藏吧,ApplicationMenu.Visible =False,我测试用RibbonTabs.Clear确实清除不了程序菜单
此主题相关图片如下:0757.png
[此贴子已经被作者于2024/11/14 14:00:53编辑过]