Link to home
Start Free TrialLog in
Avatar of keboone
keboone

asked on

hscrollbars with listbox with checkbox property enabled

Is it possible to have a horizontal scroll baR with the check box style enabled???
Avatar of elmer88techteam
elmer88techteam

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
    hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    lParam As Any) As Long
Const LB_SETHORIZONTALEXTENT = &H194

' Set the horizontal extent of the control (in pixel).
' If this value is greater than the current control's width
' an horizontal scrollbar appears.

Sub SetHorizontalExtent(lb As ListBox, ByVal newWidth As Long)
    SendMessage lb.hwnd, LB_SETHORIZONTALEXTENT, newWidth, ByVal 0&
End Sub

'The LB_GETHORIZONTALEXTENT message is useful to retrieve the current value of the horizontal extent:

'Const LB_GETHORIZONTALEXTENT = &H193

' Return the horizontal extent of the control (in pixel).

Function GetHorizontalExtent(lb As ListBox) As Long
    GetHorizontalExtent = SendMessage(lb.hwnd, LB_GETHORIZONTALEXTENT, 0, _
        ByVal 0&)
End Function

---------------------------------------------

'Example:

Private Sub Form_Load()
SetHorizontalExtent List1, 200
End Sub
ASKER CERTIFIED SOLUTION
Avatar of elmer88techteam
elmer88techteam

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial