'API申明
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long'在ListBox的Change事件中加入:
SendMessage List1.Hwnd, LB_SETHORIZONTALEXTENT, 1.02 * MaxlongStr(), ByVal 0&'自定义函数
Private Function MaxlongStr() As Integer
Dim Templen As Integer
For i = 0 To List1.ListCount - 1
  If Templen < Me.TextWidth(List1.List(i)) Then
    Templen = Me.TextWidth(List1.List(i))
  End If
Next i
MaxlongStr = Templen
End Function