Foxtable(狐表)用户栏目专家坐堂 → 生成菜单


  共有549人关注过本帖树形打印复制链接

主题:生成菜单

帅哥哟,离线,有人找我吗?
kaituozhe
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1814 积分:12229 威望:0 精华:0 注册:2015/7/18 10:10:00
生成菜单  发帖心情 Post By:2018/3/13 18:43:00 [只看该作者]

以下黄色代码的功能怎么实现不了呢?一直报错

If e.Table.Current IsNot Nothing Then
    Dim dr As DataRow = e.Table.Current.DataRow
    Dim wz As Integer = Tables("ShuDaShuJuZiDian").FindRow(dr)
    If wz >=0 Then
        Tables("ShuDaShuJuZiDian").Position = wz
    End If
    If Tables("ShuDaShuJuZiDian").current.Isnull("审核") = True
        e.form.strips("主菜单").Items("Edit").items("ShenHe").Enabled = False
        e.form.strips("主菜单").Items("Edit").items("QuXiaoShenHe").Enabled = True
   Else
       
        e.form.strips("主菜单").Items("Edit").items("ShenHe").Enabled = True
        e.form.strips("主菜单").Items("Edit").items("QuXiaoShenHe").Enabled = False
    End If
End If

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:22022 积分:112328 威望:0 精华:7 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/3/13 20:11:00 [只看该作者]

报什么错?菜单名称是否正确?

If e.Table.Current IsNot Nothing Then
    Dim dr As DataRow = e.Table.Current.DataRow
    Dim wz As Integer = Tables("ShuDaShuJuZiDian").FindRow(dr)
    If wz >=0 Then
        Tables("ShuDaShuJuZiDian").Position = wz
    End If
    Dim enabled As Boolean = Tables("ShuDaShuJuZiDian").current.Isnull("审核")
    msgbox(enabled) '弹出什么值?

    e.form.strips("主菜单").Items("Edit").items("ShenHe").Enabled = enabled
    e.form.strips("主菜单").Items("Edit").items("QuXiaoShenHe").Enabled = Not enabled
    
End If

 回到顶部
帅哥哟,离线,有人找我吗?
kaituozhe
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1814 积分:12229 威望:0 精华:0 注册:2015/7/18 10:10:00
  发帖心情 Post By:2018/3/13 22:36:00 [只看该作者]

以下生成菜单的代码,在AfterLoad事件中生成

Dim mnu As Winform.Strip
Dim itm As WinForm.StripItem
mnu = e.Form.Strips.Add("主菜单",StripTypeEnum.MainMenu)
mnu.Items.Add("File","文件(&F)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("Edit","编辑(&E)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("ShenHeShenPi","审核审批(&S)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("homepage","首页(&H)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("pageup","上页(&A)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("pagedown","下页(&P)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("lastpage","末页(&L)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("MuLuShu","打开目录(&M)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("GengXing","更新(&G)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("Option","选项(&O)","",StripItemTypeEnum.MenuItem)
mnu.Items.Add("Help","帮助(&H)","",StripItemTypeEnum.MenuItem)
'在主菜单右侧增加一个按钮
mnu.Items.Add("Home","主页","home.ico",StripItemTypeEnum.Button)
mnu.Items("Home").DisplayText = False
mnu.Items("Home").DockToRight = True '靠右停放
'为文件菜单增加项目
itm = mnu.Items("File")
itm.Items.Add("New","新建","new.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("Open","打开","Open.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("Save","保存","Save.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("Separator1", "分割条", "", StripItemTypeEnum.Separator)
itm.Items.Add("Print","打印","Print.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("Preview","打印预览","Preview.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("Separator2", "分割条", "", StripItemTypeEnum.Separator)
itm.Items.Add("Exit","退出","",StripItemTypeEnum.MenuItem)
'为常用项目增加快捷键
itm.Items("New").ShortcutKeys = Keys.Control Or Keys.N
itm.Items("Open").ShortcutKeys = Keys.Control Or Keys.O
itm.Items("Save").ShortcutKeys = Keys.Control Or Keys.S
itm = mnu.Items("Edit")
itm.Items.Add("AddNew","新增","new.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("ShanChu","删除","Open.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("ChaRu","插入","Save.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("ShanHang","删行","Save.ico",StripItemTypeEnum.MenuItem)
itm = mnu.Items("ShenHeShenPi")
itm.Items.Add("ShenHe","审核","new.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("QuXiaoShenHe","取消审核","Open.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("ShenPi","审批","Save.ico",StripItemTypeEnum.MenuItem)
itm.Items.Add("QuXiaoShenPi","取消审批","Save.ico",StripItemTypeEnum.MenuItem)


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:22022 积分:112328 威望:0 精华:7 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/3/13 22:54:00 [只看该作者]

上级节点不对呀

itm = mnu.Items("ShenHeShenPi")
itm.Items.Add("ShenHe","审核","new.ico",StripItemTypeEnum.MenuItem)


    e.form.strips("主菜单").Items("ShenHeShenPi").items("ShenHe").Enabled = enabled
    e.form.strips("主菜单").Items("ShenHeShenPi").items("QuXiaoShenHe").Enabled = Not enabled

 回到顶部