-- 作者:yaojun
-- 发布时间:2017/6/22 15:57:00
--
以下是引用有点蓝在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编辑过]
|
-- 作者:yaojun
-- 发布时间:2017/6/22 18:56:00
--
有点色老师,谢谢了,解决了
但是请老师帮忙改改如下代码:
Forms("首页").Controls("TabControl1").SelectedIndex = 1 \'获取大纲 模块 dagang = e.Page.Name mokuai = e.Link.Name \'初始化listview 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
Dim dt As Date = Date.Today.AddDays(1) Select Case e.Link.Name Case "产品展览" Forms("首页").Controls("TabControl1").SelectedIndex = 2 Dim lvww As WinForm.ListView = e.Form.Controls("ListView2") lvww.StopRedraw() \'暂停绘制 lvww.Rows.Clear() \'清除原来的行 lvww.Images.Clear() \'清除原来的图片 lvww.View = ViewMode.LargeIcon \'显示模式为 大图标 lvww.Images.LargeSize = New Size(130,120) \'定义大图标尺寸 For Each dr As DataRow In DataTables("表A").DataRows \'从数据表中提取数据 Dim Key As String = dr("图片") \'获取此员工的照片文件 lvw.Images.AddLargeImage(Key, Key) \'添加照片,直接用文件名作为图片键值 Dim vr As WinForm.ListViewRow = lvww.Rows.Add() \'增加一行 vr.Text = dr("名称") \'设置标题 vr.ImageKey = Key \'设置图片键值 vr.Tag= dr \'将DataRow赋值给ListViewRow的Tag属性,将二者联系起来 Next lvw.ResumeRedraw() \'恢复绘制 End Select
按下后Forms("首页").Controls("TabControl1").SelectedIndex = 2 不能显示,好像和Forms("首页").Controls("TabControl1").SelectedIndex = 1冲突了,请求修改
|