|
-
Nov 19th, 2007, 11:13 PM
#1
Thread Starter
Member
Listbox horizontal scroll bar
When there are more items in the list box, the vertical scroll bar appear. But when the list line too long, there is no horizontal scroll bar. How to add the Horizontal scroll bar when line exceeded windows size?
-
Nov 19th, 2007, 11:16 PM
#2
Lively Member
Re: Listbox horizontal scroll bar
vb Code:
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const LB_SETHORIZONTALEXTENT = &H194
Public Function ListBoxHBar(LstBox As ListBox, Frm As Form)
Dim lngReturn As Long
Dim lngExtent As Long
With Frm
.ScaleMode = 3
.Font = LstBox.Font
.FontBold = LstBox.FontBold
.FontItalic = LstBox.FontItalic
.FontSize = LstBox.FontSize
For i = 0 To LstBox.ListCount - 1
If lngExtent < .TextWidth(LstBox.List(i)) Then lngExtent = .TextWidth(LstBox.List(i))
Next i
End With
lngReturn = SendMessage(LstBox.hWnd, LB_SETHORIZONTALEXTENT, lngExtent, 0&)
End Function
Code found here
-
Nov 20th, 2007, 07:04 AM
#3
Re: Listbox horizontal scroll bar
Or, you can try this
vb Code:
Private Declare Function ShowScrollBar Lib "user32" _
(ByVal hwnd As Long, ByVal wBar As Long, _
ByVal bShow As Long) As Long
Private Const SB_HORIZONTAL = 0
Private Sub Form_Load()
ShowScrollBar List1.hwnd, SB_HORIZONTAL, True
End Sub
-
Nov 20th, 2007, 11:38 PM
#4
Thread Starter
Member
Re: Listbox horizontal scroll bar
Thanks everyone, solved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|