Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| 'Controls - How to add Horizonal Scroll Bar to ListBox
Option Explicit
'Add a ListBox to your form and add a long string to the ListBox list.
Private Declare Function SendMessageByNum Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const LB_SETHORIZONTALEXTENT = &H194
Private Sub Form_Load()
Static x As Long
If x < TextWidth(List1.List(0) & " ") Then
x = TextWidth(List1.List(0) & " ")
If ScaleMode = vbTwips Then x = x / Screen.TwipsPerPixelX
SendMessageByNum List1.hwnd, LB_SETHORIZONTALEXTENT, x, 0
End If
End Sub |