Dim tab As WinForm.TabControl
tab = forms("我的导航").CreateControl("Tab1", ControlTypeEnum.TabControl)
tab.Dock = Windows.Forms.DockStyle.Fill
tab.Font = New Font("微软雅黑", 10)
forms("我的导航").AddControl(tab)
Dim Arys As List(Of String())
Dim Products As List(Of String)
Products = DataTables("功能导航").GetValues("功能区")
For Each Product As String In Products
Dim pg As WinForm.TabPage
pg = tab.TabPages.Add(Product , Product & " →")
pg.BackColor = Color.WhiteSmoke
Dim dr As DataRow= DataTables("功能导航").Find("功能区='" & Product & "'")
If dr IsNot Nothing Then
pg.Image = GetImage(dr("分类图标"))
End If
Dim Customers As List(Of String)
Customers = DataTables("功能导航").GetValues("功能组","功能区='" & Product & "'","序号")
For Each Customer As String In Customers
Dim lvw As WinForm.ListView
lvw = forms("我的导航").CreateControl(Customer, ControlTypeEnum.ListView)
lvw.Dock = Windows.Forms.DockStyle.Fill
lvw.Font = New Font("微软雅黑", 10)
pg.AddControl(lvw)
lvw.StopRedraw() '暂停绘制
lvw.Groups.Clear
lvw.Rows.Clear() '清除原来的行
lvw.Images.Clear() '清除原来的图片
lvw.View = ViewMode.LargeIcon
lvw.Images.LargeSize = New Size(48, 48) '定义大图标尺寸
Dim vg As WinForm.ListViewGroup = lvw.Groups.Add() '增加分组
vg.Name = Customer
vg.Text = "☆☆☆" & Customer & "☆☆☆"
Arys = DataTables("功能导航").GetValues("模块名称|模块标题|模块图标","功能区='" & Product & "'And 功能组='" & Customer & "'","序号")
For Each Ary As String() In Arys
Dim key As String = Ary(2)
lvw.Images.AddLargeImage(key, key) '添加照片,直接用文件名作为图片键值
Dim vr As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
vr.Group = vg.Name
vr.Name = Ary(0)
vr.Text = Ary(1)
vr.ImageKey = key
Next
lvw.ResumeRedraw() '恢复绘制
Next
Next
不能分组
[此贴子已经被作者于2014-9-15 21:19:28编辑过]