本文向大家展示了listview控件在report视图下任何列头的双向排序技巧,源代码如下 Option Explicit Private Sub Form_Load() Dim i As Integer Dim itemx As ListItem ListView1.View = lvwReport With ListView1.ColumnHeaders .Add , , "编号", 600, lvwColumnLeft For i = 1 To 2 .Add , , "内容项" & i, 1000, lvwColumnRight Next End With With ListView1.ListItems For i = 1 To 10 Set itemx = .Add itemx.SubItems(1) = i itemx.SubItems(2) = Chr(64 + i) itemx.SubItems(3) = Format(DateAdd("m", i, Date), "yyyy-mm-dd") Next End With End Sub Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) With ListView1 If (ColumnHeader.Index - 1) = .SortKey Then .SortOrder = (.SortOrder + 1) Mod 2 Else .Sorted = False .SortOrder = 0 .SortKey = ColumnHeader.Index - 1 .Sorted = True End If End With End Sub 希望看到更多更经典的开发技巧,请随时刷新《开发特区》栏目。 |
闂備浇銆€閸嬫捇鏌熼婊冾暭妞ゃ儲鍨块弻鐔衡偓娑櫭慨鍥р攽椤曞棙瀚�闂備礁鎼悮顐﹀磿閸愯鑰块柛娑欐綑缂佲晠鏌熼婊冾暭妞ゃ儻鎷�>>
正在阅读:实现report视图下任何列头的双向排序实现report视图下任何列头的双向排序
2004-02-14 09:34
出处:PConline
责任编辑:linjixiong