在FOXTABLE示例中,将国家按洲分类,代码如下:
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.StopRedraw() '停止绘制
lvw.Groups.Clear()
lvw.Columns.Clear() '清除原来的列
lvw.Rows.Clear() '清除原来的行
lvw.Images.Clear() '清除原来的图片
lvw.View = ViewMode.Details '显示模式为详细信息
Dim cls() As String = {"国家","人口","面积","语言","宗教"} '定义列名
Dim wds() As Integer = {100,100,150,80,80} '定义列宽
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) '指定列宽
Next
For Each zh As String In DataTables("国家").GetValues("洲") '增加分组
Dim grp As WinForm.ListViewGroup = lvw.Groups.Add()
grp.Name = zh
grp.Text = zh
Next
For Each dr As DataRow In DataTables("国家").DataRows
Dim Key As String = dr("图标")
Dim r As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
lvw.Images.AddImage(Key, Key & ".ico", Key & "48.ico") '添加代表这个国家的一对图标
r.ImageKey = Key '指定图标键值
r.Group = dr("洲") '指定所属分组
For Each cl As String In cls '逐列取值
Select Case cl
Case "人口","面积" '如果是人口列或面积列
r(cl) = format(dr(cl),"#,000") '则显示千位分割符号
Case Else
r(cl) = dr(cl)
End Select
Next
Next
lvw.ResumeRedraw() '恢复绘制
请教:
如果在国家表中,增加序号列,在按洲分类时,各洲内的国家按序号排位(不按[_Identify]),如何修改代码?谢谢