Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows
Visual Basic > Forms sample source codes
Use a horizontal scrollbar with a listbox
Use a horizontal scrollbar with a listbox Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long Const WM_USER = &H400 Const LB_SETHORIZONTALEXTENT = WM_USER + 21 Sub CheckListBox dim i%, res& dim Scrollwidth& For i% = 0 To Form1.List1.ListCount If Form1.TextWidth(Form1.List1.List(i%)) > Scrollwidth& Then _ Scrollwidth& = Form1.TextWidth(Form1.List1.List(i%)) Next i% res& = SendMessage(Form1.List1.hWnd, LB_SETHORIZONTALEXTENT, _ Scrollwidth&, 0&) End Sub Call this procedure everytime the content of the listbox has changed. Return
Privacy Policy
|
Link to Us
|
Links