VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Add a horizontal scroll bar to a list box

by Anonymous (267 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Sat 23rd January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



'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

Download this snippet    Add to My Saved Code

Add a horizontal scroll bar to a list box Comments

No comments have been posted about Add a horizontal scroll bar to a list box. Why not be the first to post a comment about Add a horizontal scroll bar to a list box.

Post your comment

Subject:
Message:
0/1000 characters