提示 未将对象引用设置到对象的实例。另外SelectedIndexChanged事件怎么设置?
Dim o As WinForm.NavBar
Dim fnt As New Font("微软雅黑",9)
o.name="o"
o.dock=5 '锚定
o.VisualStyle=2 '主题
o.Font =fnt
Dim PageList As List(Of String)
If _UserRoles<>"系统管理员" Then
If len(_UserRoles)>0 Then
PageList = dt.GetValues("分类","用户标识='" & _UserRoles & "' and 单据权限=1","模块顺序,分类顺序,单据顺序")
Else
PageList = dt.GetValues("分类","用户标识='" & _UserID & "' and 单据权限=1","模块顺序,分类顺序,单据顺序")
End If
Else
PageList = dt.GetValues("分类","启用=1","模块顺序,分类顺序,顺序")
End If
For i As Integer =0 To PageList.Count-1
Dim p1 As WinForm.NavPage'新建页面
Dim r As Integer
p1.name=PageList(i)
p1.text= PageList(i)
p1.font = fnt
o.NavPages.add(p1.name,p1.name,"")
Dim ButtonList As List(of String())
If _UserRoles<>"系统管理员" Then
If len(_UserRoles)>0 Then
ButtonList = dt.GetValues("单据|单据图标","用户标识='" & _UserRoles & "' and 单据权限=1 and 分类='" & PageList(i) & "'","模块顺序,分类顺序,单据顺序")
Else
ButtonList = dt.GetValues("单据|单据图标","用户标识='" & _UserID & "' and 单据权限=1 and 分类='" & PageList(i) & "'","模块顺序,分类顺序,单据顺序")
End If
Else
ButtonList = dt.GetValues("单据|单据图标","启用=1 and 分类='" & PageList(i) & "'","模块顺序,分类顺序,顺序")
End If
For Each Ary As String() In ButtonList
r=r+1
Dim but As WinForm.Button
but = e.Form.CreateControl("navbar_" & Ary(0) , ControlTypeEnum.Button)
With but
.Text = Ary(0)
.Left = 10
.Height=30
.Width=180
.Top = (r-1)*30
.Font=fnt
.FlatStyle = FlatStyle.flat
.BackColor = Color.Transparent
.MouseOverBackColor=Color.DarkTurquoise
.BorderSize = 0
.Image=GetImage(Ary(1).Split(".")(0)& "_navbar." & Ary(1).Split(".")(1))
.ImageAlign=ContentAlignment.MiddleLeft
End With
o.NavPages(PageList(i)) .controls.add(but.basecontrol)
Next
r=0
Next
e.Form.Controls("Panel1").basecontrol.controls.add(o)