Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.View = ViewMode.Details
lvw.Images.AddSmallImage("Man", "Man.ico") '添加代表男性的图标
lvw.Images.AddSmallImage("Woman", "Woman.ico") '添加代表女性的图标
lvw.Images.AddSmallImage("mo", "user_silhouette.png") '添加代表女性的图标
lvw.GridLines = True
Dim cls() As String = {"员工编号","员工姓名","所在部门","职务","性别","原籍地址"} '定义列名
Dim wds() As String = {100,80,80,90,40,135} '定义列宽
For i As Integer = 0 To cls.Length - 1 '增加列
Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
c.Text = cls(i) '指定列标题
c.Name = cls(i) '指定列名
c.Width = wds(i) '指定列宽
Next
Tables("员工信息").Sort = "员工编号"
For Each dr As DataRow In DataTables("员工信息").DataRows '从数据表中提取数据
Dim vr As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
For Each cl As String In cls '逐列取值
vr(cl) = dr(cl)
Next
If dr("性别") = "男" Then '设置分组
vr.ImageKey = "Man"
Else
If dr("性别") = "女" Then '设置分组
vr.ImageKey = "Woman"
Else
vr.ImageKey = "MO"
End If
End If
vr.Tag= dr '将DataRow赋值给ListViewRow的Tag属性,将二者联系起来
Next
lvw.ResumeRedraw() '恢复绘制
不知道加哪里哦