'训练管理页面生成 If e.Sender.SelectedPage.Text ="训练管理" Then Dim lvw As WinForm.ListView = e.Form.Controls("LV训练成绩") lvw.StopRedraw() '停止绘制 lvw.Groups.Clear() '清除原来的分组 lvw.Columns.Clear() '清除原来的列 lvw.Rows.Clear() '清除原来的行 lvw.Images.Clear() '清除原来的图片 lvw.View = ViewMode.Details '显示模式为详细信息 Dim cls() As String = {"","姓名","JX","职务","考核情况_完成时间","考核情况_扣分情况","考核情况_最终得分","等级评定","考核时间"} '定义列名 Dim wds() As Integer = {0,80,80,80,100,100,100,80,100} '定义列宽 For i As Integer = 0 To cls.Length - 1 '增加列 Dim c As WinForm.ListViewColumn = lvw.Columns.Add() c.Name = cls(i) '指定列名 c.Text = cls(i) '指定标题,这里标题和列名相同 c.Width = wds(i) '指定列宽 c.TextAlign = HorizontalAlignment.center Next For Each zh As String In DataTables("考核成绩表").GetValues("考核项目") '增加分组 Dim grp As WinForm.ListViewGroup = lvw.Groups.Add() grp.Name = zh grp.Text = zh For Each xm As String In DataTables("考核成绩表").GetValues("姓名", "考核项目 = '" & zh & "'") Dim dr As DataRow = DataTables("考核成绩表").find("考核项目 = '" & zh & "' and 姓名 = '" & xm & "'", "考核时间 desc") Dim r As WinForm.ListViewRow = lvw.Rows.Add() '增加一行 r.Group = dr("考核项目") '指定所属分组 For Each cl As String In cls '逐列取值 If cl > "" r(cl) = dr(cl) End If Next Next Next lvw.ResumeRedraw() '恢复绘制 lvw.Columns("考核情况_完成时间").Text = "考核用时" '修改考"核情况_完成时间"列的标题 lvw.Columns("考核情况_扣分情况").Text = "扣分情况" lvw.Columns("考核情况_最终得分").Text = "最终得分" End If
|