以下是引用有点蓝在2017/6/22 14:25:00的发言:
ListView1
可是我的ListView1里面的按钮是用专家坐堂里面的框架设计的代码动态生成,这个好像不行哦。
'生成任务栏导航
'1生成页面
Dim r2 As List(of String()) = DataTables("大纲管理").GetValues("名称|图标","","顺序")
'遍历大纲
For Each rl As String() In r2
'大纲权限过滤
If User.Type<>UserTypeEnum.Developer Then
Dim qx As String = DataTables("单据权限").GetComboListString("大纲","大纲 = '" & rl(0) & "' and 用户名称 = '" & User.Name & "'")
If qx.IndexOf(rl(0))<> -1 Then
'添加页面
Dim Page As WinForm.TopicPage
Page=Forms("首页").Controls("TopicBar1").Pages.Add(rl(0),rl(0),rl(1))
'2添加任务
Dim r1 As List(of String()) = DataTables("模块管理").GetValues("模块名称|图标","大纲 ='" & rl(0) & "'","顺序")
For Each r1l As String() In r1
'模块过滤
Dim mk As String = DataTables("单据权限").GetComboListString("模块","大纲='" & rl(0) & "'and 模块 = '" & r1l(0) & "' and 用户名称 = '" & User.Name & "'")
If mk.IndexOf(r1l(0))<> -1 Then
Page.Links.Add(r1l(0),r1l(0),r1l(1))
End If
Next
End If
Else
Dim Page As WinForm.TopicPage
Page=Forms("首页").Controls("TopicBar1").Pages.Add(rl(0),rl(0),rl(1))
'2添加任务
Dim r1 As List(of String()) = DataTables("模块管理").GetValues("模块名称|图标","大纲 ='" & rl(0) & "'","顺序")
For Each r1l As String() In r1
Page.Links.Add(r1l(0),r1l(0),r1l(1))
Next
End If
Next
'添加单据
Dim tp As WinForm.TopicBar = e.Form.Controls("TopicBar1")
dagang = tp.Pages(0).Name '大纲
mokuai = tp.Pages(0).Links(0).Name '模块
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.Groups.Clear() '清除原来的分组
lvw.Rows.Clear() '清除原来的行
lvw.Images.Clear() '清除原来的图片
lvw.View = ViewMode.LargeIcon
lvw.Images.LargeSize = New Size(32,32)
'获取模块包含的小类
Dim fenzu As List(of String)= DataTables("模块分类").GetValues("模块小类","大纲 = '" & dagang & "' and 模块名称 = '" & mokuai & "' ","顺序")
For Each fz As String In fenzu
If User.Type<>UserTypeEnum.Developer Then
Dim qx As String = DataTables("单据权限").GetComboListString("分类","大纲='" & dagang & "' and 模块='" & mokuai & "' and 分类 = '" & fz & "' and 用户名称 = '" & User.Name & "'")
If qx.IndexOf(fz) <> -1 Then
'添加分组
Dim vg As WinForm.ListViewGroup = lvw.Groups.add()
vg.Name=fz
vg.text= "☆☆☆ [ " & fz & " ]"
'获取单据名称和图标,逐个添加
Dim DanJ As List(of String())= DataTables("窗体发布").GetValues("单据|图标","大纲='" & dagang & "' and 模块='" & mokuai & "' and 分类='" & fz & "'","顺序")
For Each dj As String() In DanJ
Dim qx1 As String = DataTables("单据权限").GetComboListString("单据", "大纲='" & dagang & "' and 模块='" & mokuai & "' and 分类='" & fz & "' and 单据 = '" & dj(0) & "' and 用户名称 = '" & User.Name & "'")
If qx1.IndexOf(dj(0)) <> -1 Then
Dim r As WinForm.ListViewRow = lvw.Rows.add()
r.Text=dj(0)
r.Group=fz
lvw.Images.AddImage(dj(1),dj(1) , dj(1)) '图标
r.ImageKey=dj(1)
End If
Next
End If
Else
'添加分组
Dim vg As WinForm.ListViewGroup = lvw.Groups.add()
vg.Name=fz
vg.text= "☆☆☆ [ " & fz & " ]"
'获取单据名称和图标,逐个添加
Dim DanJ As List(of String())= DataTables("窗体发布").GetValues("单据|图标","大纲='" & dagang & "' and 模块='" & mokuai & "' and 分类='" & fz & "'","顺序")
For Each dj As String() In DanJ
Dim r As WinForm.ListViewRow = lvw.Rows.add()
r.Text=dj(0)
r.Group=fz
lvw.Images.AddImage(dj(1),dj(1) , dj(1)) '图标
r.ImageKey=dj(1)
Next
End If
Next
[此贴子已经被作者于2017/6/22 15:59:32编辑过]