'新建一个工程,放个按钮和LISTBOX(用缺省名字),粘贴下面代码进去 Private Const LB_SETHORIZONTALEXTENT = &H194 Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Sub Command1_Click() SendMessage List1.hwnd, LB_SETHORIZONTALEXTENT, 800, 0 '800 is the new width End SubPrivate Sub Form_Load() For i = 1 To 99 List1.AddItem i Next End Sub
Private Const LB_SETHORIZONTALEXTENT = &H194
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Sub Command1_Click()
SendMessage List1.hwnd, LB_SETHORIZONTALEXTENT, 800, 0
'800 is the new width
End SubPrivate Sub Form_Load()
For i = 1 To 99
List1.AddItem i
Next
End Sub