以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  在分区面板1中生成导航  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=132626)

--  作者:cd_tdh
--  发布时间:2019/3/26 10:10:00
--  在分区面板1中生成导航

老师,我想在分区面板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编辑过]

--  作者:有点甜
--  发布时间:2019/3/26 12:32:00
--  

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

 

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


--  作者:cd_tdh
--  发布时间:2019/3/26 12:46:00
--  

 

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


--  作者:有点甜
--  发布时间: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
--  发布时间:2019/3/26 13:34:00
--  
老师,我需要根据子系统导航,在主窗口的分区面板1的panel1中自动生成导航栏。
--  作者:有点甜
--  发布时间: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) \'控件添加到容器