下面的代码就算有再多的记录也不会有慢的感觉(只是感觉,时间还是要的 ^_^ ): Option ExplicitPrivate Type RECT Left As Long Top As Long Right As Long Bottom As Long End TypePrivate Declare Function InvalidateRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long) As Long Private Declare Function ValidateRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As LongPrivate Sub Command1_Click() Dim rcClient As RECT Dim I As Long, lngCount As Long
Call GetClientRect(List2.hwnd, rcClient)
List2.Clear lngCount = List1.ListCount For I = 0 To lngCount - 1 List2.AddItem List1.List(I)
If I > 100 Then Call ValidateRect(List2.hwnd, rcClient) End If DoEvents Next I Call InvalidateRect(List2.hwnd, rcClient, True) End Sub
For i = 0 To List1.ListCount - 1
List2.AddItem List1.List(i)
DoEvents
Next i
好象只能选换去additem啊,代码同楼上
List1里的数据是怎么加进去的?
Option ExplicitPrivate Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypePrivate Declare Function InvalidateRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long) As Long
Private Declare Function ValidateRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As LongPrivate Sub Command1_Click()
Dim rcClient As RECT
Dim I As Long, lngCount As Long
Call GetClientRect(List2.hwnd, rcClient)
List2.Clear
lngCount = List1.ListCount
For I = 0 To lngCount - 1
List2.AddItem List1.List(I)
If I > 100 Then
Call ValidateRect(List2.hwnd, rcClient)
End If
DoEvents
Next I
Call InvalidateRect(List2.hwnd, rcClient, True)
End Sub
for i=1 to 1000000
list1.additem cstr(i)
next i
感觉是你想出来的,应该没作吧