Foxtable(狐表)用户栏目专家坐堂 → 在分区面板1中生成导航


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

主题:在分区面板1中生成导航

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


加好友 发短信
等级:狐精 帖子:3056 积分:20456 威望:0 精华:0 注册:2016/3/28 16:57:00
在分区面板1中生成导航  发帖心情 Post By:2019/3/26 10:10:00 [只看该作者]

老师,我想在分区面板1中生成导航,下面代码怎么改?

'生成左侧导航
Dim frm As WinForm.SplitPanel = Forms("主窗口").Controls("SplitContainer1").panel1
'For Each kj As WinForm.Control In frm.Controls
    'frm.RemoveControl(kj.Name)
'Next
Dim o As new C1.Win.C1Command.C1OutBar
o.name = "o"
o.dock = 5 '锚定
o.VisualStyle = 5 'VisualStyle.Office2007Blue '页面主题
o.pagetitleheight = 30 '页面高度
Dim zaj As List(of String) = DataTables("子系统导航").GetValues("分组","","序号")
For Each za As String In zaj
    Dim p1 As new C1.Win.C1Command.C1OutPage '新建页面
    p1.name=za
    p1.text=za
    o.Pages.add(p1)
    Dim ajm As List(of DataRow) = DataTables("子系统导航").Select("分组='" & za & "'","序号 Desc")
    For Each aj2 As DataRow In ajm
        Dim aj As String = aj2("名称")
        Dim jpg As String = aj2("图标")
        Dim hsmc As String =aj2("名称")
        Dim abc As WinForm.Button
        abc=frm.CreateControl(hsmc,ControlTypeEnum.button)
        abc.Text=aj
        abc.Dock= 1 '锚定
        abc.Height= 30 '页面高度
        abc.Image=GetImage(jpg)  '图标
        abc.ImageAlign= ContentAlignment.MiddleLeft '图标位置,靠左居中
        abc.TextAlign = ContentAlignment.MiddleLeft '名称位置,靠左居中
        abc.TextImageRelation = TextImageRelation.ImageBeforeText '图标在文本之前   Automatic  '图标相对位置'自动
        abc.VisualStyle= IVisualStyle.Office2010Black  '按钮主题
        frm.AddControl(abc)
        o.Pages(za).controls.add(Forms("主窗口").Controls(hsmc).basecontrol)
    Next
Next

[此贴子已经被作者于2019/3/26 10:10:23编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/3/26 12:32:00 [只看该作者]

1、现在遇到什么问题?报什么错了么?

 

2、具体实例发上来测试。


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


加好友 发短信
等级:狐精 帖子:3056 积分:20456 威望:0 精华:0 注册:2016/3/28 16:57:00
  发帖心情 Post By:2019/3/26 12:46:00 [只看该作者]

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:实名制系统.rar


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/3/26 13:23:00 [只看该作者]

这样不报错,但不清楚你要做什么功能。

 

'Dim tv  As WinForm.TreeView
'tv =e.Form.Controls("TreeView1")
'tv.BuildTree("子系统导航",  "分组|名称")
'

''AfterLoad事件
'If e.Form.Width> 0 AndAlso e.Form.height > 0 Then
'vars("width") = e.Form.width
'vars("height") = e.Form.height
'End If

'生成编译函数
Dim code As String
code= " dim name as string = args(0) " & vbcrlf
code= code & " Select Case name " & vbcrlf
For Each dr As DataRow In DataTables("子系统导航").DataRows
    If dr("代码")> ""  Then
        code = code & " case " & """" & dr("名称") & """" & vbcrlf
        code = code & dr("代码")  & vbcrlf
    End If
Next
code= code & "end  Select  " & vbcrlf
Functions.Remove("nav")
Functions.Add("nav",Code)

Functions.Complie
'生成左侧导航
Dim frm = Forms("主窗口").Controls("SplitContainer1").panel1
'For Each kj As WinForm.Control In frm.Controls
'frm.RemoveControl(kj.Name)
'Next
Dim o As new C1.Win.C1Command.C1OutBar
o.name = "o"
o.dock = 5 '锚定
o.VisualStyle = 5 'VisualStyle.Office2007Blue '页面主题
o.pagetitleheight = 30 '页面高度
Dim zaj As List(of String) = DataTables("子系统导航").GetValues("分组","","序号")
For Each za As String In zaj
    Dim p1 As new C1.Win.C1Command.C1OutPage '新建页面
    p1.name=za
    p1.text=za
    o.Pages.add(p1)
    Dim ajm As List(of DataRow) = DataTables("子系统导航").Select("分组='" & za & "'","序号 Desc")
    For Each aj2 As DataRow In ajm
        Dim aj As String = aj2("名称")
        Dim jpg As String = aj2("图标")
        Dim hsmc As String =aj2("名称")
        Dim abc As WinForm.Button
        abc=e.Form.CreateControl(hsmc,ControlTypeEnum.button)
        abc.Text=aj
        abc.Dock= 1 '锚定
        abc.Height= 30 '页面高度
        abc.Image=GetImage(jpg)  '图标
        abc.ImageAlign= ContentAlignment.MiddleLeft '图标位置,靠左居中
        abc.TextAlign = ContentAlignment.MiddleLeft '名称位置,靠左居中
        abc.TextImageRelation = TextImageRelation.ImageBeforeText '图标在文本之前   Automatic  '图标相对位置'自动
        abc.VisualStyle= IVisualStyle.Office2010Black  '按钮主题
        frm.AddControl(abc)
        o.Pages(za).controls.add(Forms("主窗口").Controls(hsmc).basecontrol)
    Next
Next

Dim pal2 As WinForm.Panel
pal2 = e.Form.CreateControl("Panel2",ControlTypeEnum.Panel)
pal2.dock = 5  '锚定
pal2.Height= 300 '页面高度
frm.AddControl(pal2)  '增加Panel
'frm.Controls("Panel2").basecontrol.controls.add(o) '控件添加到容器


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


加好友 发短信
等级:狐精 帖子:3056 积分:20456 威望:0 精华:0 注册:2016/3/28 16:57:00
  发帖心情 Post By:2019/3/26 13:34:00 [只看该作者]

老师,我需要根据子系统导航,在主窗口的分区面板1的panel1中自动生成导航栏。

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/3/26 15:10:00 [只看该作者]

'Dim tv  As WinForm.TreeView
'tv =e.Form.Controls("TreeView1")
'tv.BuildTree("子系统导航",  "分组|名称")
'

''AfterLoad事件
'If e.Form.Width> 0 AndAlso e.Form.height > 0 Then
'vars("width") = e.Form.width
'vars("height") = e.Form.height
'End If

'生成编译函数
Dim code As String
code= " dim name as string = args(0) " & vbcrlf
code= code & " Select Case name " & vbcrlf
For Each dr As DataRow In DataTables("子系统导航").DataRows
    If dr("代码")> ""  Then
        code = code & " case " & """" & dr("名称") & """" & vbcrlf
        code = code & dr("代码")  & vbcrlf
    End If
Next
code= code & "end  Select  " & vbcrlf
Functions.Remove("nav")
Functions.Add("nav",Code)

Functions.Complie
'生成左侧导航
Dim frm = Forms("主窗口").Controls("SplitContainer1").panel1
'For Each kj As WinForm.Control In frm.Controls
'frm.RemoveControl(kj.Name)
'Next
Dim o As new C1.Win.C1Command.C1OutBar
o.name = "o"
o.dock = 5 '锚定
o.VisualStyle = 5 'VisualStyle.Office2007Blue '页面主题
o.pagetitleheight = 30 '页面高度
Dim zaj As List(of String) = DataTables("子系统导航").GetValues("分组","","序号")
For Each za As String In zaj
    Dim p1 As new C1.Win.C1Command.C1OutPage '新建页面
    p1.name=za
    p1.text=za
    o.Pages.add(p1)
    Dim ajm As List(of DataRow) = DataTables("子系统导航").Select("分组='" & za & "'","序号 Desc")
    For Each aj2 As DataRow In ajm
        Dim aj As String = aj2("名称")
        Dim jpg As String = aj2("图标")
        Dim hsmc As String =aj2("名称")
        Dim abc As WinForm.Button
        abc=e.Form.CreateControl(hsmc,ControlTypeEnum.button)
        abc.Text=aj
        abc.Dock= 1 '锚定
        abc.Height= 30 '页面高度
        abc.Image=GetImage(jpg)  '图标
        abc.ImageAlign= ContentAlignment.MiddleLeft '图标位置,靠左居中
        abc.TextAlign = ContentAlignment.MiddleLeft '名称位置,靠左居中
        abc.TextImageRelation = TextImageRelation.ImageBeforeText '图标在文本之前   Automatic  '图标相对位置'自动
        abc.VisualStyle= IVisualStyle.Office2010Black  '按钮主题
        frm.AddControl(abc)
        o.Pages(za).controls.add(Forms("主窗口").Controls(hsmc).basecontrol)
    Next
Next

'Dim pal2 As WinForm.Panel
'pal2 = e.Form.CreateControl("Panel2",ControlTypeEnum.Panel)
'pal2.dock = 5  '锚定
'pal2.Height= 300 '页面高度
'frm.AddControl(pal2)  '增加Panel
frm.basecontrol.controls.add(o) '控件添加到容器


 回到顶部