以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=98507)

--  作者:jackyfashion
--  发布时间:2017/3/30 22:20:00
--  求助
您 好!大师:
这是我的"ListView" 代码, 在显示图标是降序,请大师指教! 谢谢!!!
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.StopRedraw
lvw.View = ViewMode.LargeIcon \'显示模式为详细内容
lvw.GridLines = False \'显示网格线
lvw.MultiSelect = False  \'禁止选择多行
Dim cls() As String = {"ffikgn","kkth","ptyn"}
Dim wds() As Integer = {70,70,70}  \'定义列宽
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
lvw.Columns("ffikgn").Text = "款号"
lvw.Columns("kkth").Text = "品牌"
lvw.Columns("ptyn").Text = "客户"
lvw.VirtualMode = True  \'以虚拟模式显示
lvw.VirtualListSize = Tables("qrymyf").Rows.count
lvw.ResumeRedraw
这是"ListView"图标代码:
If Tables("qrymyf").Rows.Count = 0 Then
    Return
End If
If Tables("qrymyf").current.IsNull("ltsu") = False Then
   \' Tables("qrymyf").Sort = "ltsu DESC"
    Dim tt As Table = Tables("yywrkhtc")
    Dim lt = tt(0)("khtc") & "\\"
    Dim lvw As WinForm.ListView = e.Sender
\'    lvw.StopRedraw
    Dim dr As DataRow = DataTables("qrymyf").dataRows(e.Index) \'根据行位置从数据表中取得对应的DataRow
    Dim Key As String = dr("ltsu")
    lvw.Images.LargeSize = New Size(100,150)
    lvw.Images.AddImage(Key,lt & Key & ".",lt & Key & ".")
    e.Row.Imagekey = key \'指定图标键值
    e.Row.Tag = dr \'将DataRow赋值给ListViewRow的Tag属性,将二者联系起来
    For Each cl As WinForm.ListViewColumn In lvw.Columns \'逐列取值
        Select Case cl.Name
            Case "ffikgn","ffaa" \'如果是人口列或面积列
                e.Row(cl.Name) = dr(cl.Name) \'则显示千位分割符号
            Case Else
                e.Row(cl.Name) = dr(cl.Name)
                e.Row.ToolTipText = "设 计 师: " & dr("ymyfjgm") 
                Dim nm As String = dr("vdmh")
                Dim nm2 As String = dr("pjsy")
                If nm = False And nm2 = False Then
                    e.Row.ForeColor =  Color.White
                ElseIf nm = True And nm2 = False Then
                    e.Row.ForeColor =  Color.DeepSkyBlue
                ElseIf nm2 = True Then
                    e.Row.ForeColor =  Color.Lime
                End If
        End Select
    Next
\'    lvw.ResumeRedraw
End If

--  作者:有点色
--  发布时间:2017/3/30 22:51:00
--  

Dim dr As DataRow = DataTables("qrymyf").dataRows(e.Index) \'根据行位置从数据表中取得对应的DataRow

 

改成

 

Dim drs = DataTables("qrymyf").Select("", "ltsu DESC")

Dim dr As DataRow = drs(e.Index) \'根据行位置从数据表中取得对应的DataRow


--  作者:jackyfashion
--  发布时间:2017/3/31 21:44:00
--  
谢谢大师!!!