Add a horizontal scroll bar to a list box
Add a horizontal scroll bar to a list box
API Declarations
Const LB_SETHORIZONTALEXTENT = &H194
Rate Add a horizontal scroll bar to a list box
(3(3 Vote))
'horizontal scroll bar. This can be a problem when the item in a ListBox extends
'past the boundaries of the ListBox. To add a horizontal scroll bar to the control,
'you can call the Windows API SendMessage function with the
'LB_SETHORIZONTALEXTENT constant.
Dim s As String
Static x As Long
s = InputBox("Please enter any text", "List scroll", "this is a simple scrollbar sample for demonstration purposes")
List1.AddItem s
If x < TextWidth(s & " ") Then
x = TextWidth(s & " ")
End If
If ScaleMode = vbTwips Then
x = x / Screen.TwipsPerPixelX ' if twips change to pixels
SendMessageByNum List1.hwnd, LB_SETHORIZONTALEXTENT, x, 0
End If
Add a horizontal scroll bar to a list box Comments
No comments yet — be the first to post one!
Post a Comment