这样不报错,但不清楚你要做什么功能。
'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) '控件添加到容器