问题2:手工删除了本地文件后,listview关于此行的图片无法显示,出现空白。发现问题可能出在文件路径上,自动更新的图片文件在RemoteFiles文件夹,而listview加载的文件在images文件夹,请问如何指定listview的图片文件路径到RemoteFiles?
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.StopRedraw() '暂停绘制
lvw.Rows.Clear() '清除原来的行
lvw.Images.Clear() '清除原来的图片
lvw.View = ViewMode.Tile '显示模式为平铺
lvw.Images.LargeSize = New Size(110,120) '定义大图标尺寸
lvw.TitleSize = New Size(200,150) '设置平铺区域的大小
Dim cls() As String = {"姓名","空行","金币","空行2","当前印章","空行3","勋章","空行4","经验值"} '定义列名
For i As Integer = 0 To cls.Length - 1 '增加列
Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
c.Name = cls(i) '指定列名
Next
For Each dr As DataRow In DataTables("学生信息").Select("", "累计获得金币 desc") '从数据表中提取数据
Dim Key As String = dr("照片").Replace("//", "") '获取此员工的照片文件
lvw.Images.AddLargeImage(Key, Key) '添加照片,直接用文件名作为图片键值
Dim vr As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
vr.ToolTipText = dr("团队名称") '设置此行的动态提示
vr.ImageKey = Key '设置图片键值
vr("姓名") = dr("姓名")
vr("空行") = " "
vr("金币") = "金币:" & dr("金币")
vr("空行2") = " "
'--------------计算当前学生的有效印章数量----------------------
Dim sum As Integer = 0
Dim drs As List(Of DataRow) = DataTables("龙源宝藏").Select("学生编号 = '"& dr("学生编号") &"' And 印章有效 = 1")
If drs.Count > 0 Then
For Each dr1 As DataRow In drs
Dim yxyz As Integer = dr1("路队") + dr1("用餐") + dr1("午休") + dr1("作业") + dr1("运气") + dr1("惩罚") + dr1("印章补差") + dr1("奖励")
sum = sum + yxyz
Next
End If
'--------------计算当前学生的有效印章数量----------------------
vr("当前印章") = "印章:" & sum
vr("空行3") = " "
vr("勋章") = "勋章:" & DataTables("成长勋章").Compute("count(成长勋章)","姓名 = '" & dr("姓名") & "'")
vr("空行4") = " "
vr("经验值") = "经验:" & dr("累计获得金币")
vr.Tag = dr
Next
lvw.ResumeRedraw() '恢复绘制