'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
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
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货