vb中ListBox怎么加左右滚动条ScrollBar
???当item的宽度小于listbox的宽度时,如何隐藏ScrollBar还有初始时如何隐藏ScrollBar...
???
当item的宽度小于listbox的宽度时,如何隐藏ScrollBar
还有初始时如何隐藏ScrollBar 展开
当item的宽度小于listbox的宽度时,如何隐藏ScrollBar
还有初始时如何隐藏ScrollBar 展开
2个回答
推荐于2016-09-22
展开全部
参考如下:
Private Sub Form_Load()
Dim Information#, Scrollbar#
For Information = 1 To 88
List1.AddItem _
"横滚动条示范" & _
"横滚动条示范" & _
"横滚动条示范"
Next Information
Information = SendMessageLong(List1.hwnd, LB_SETHORIZONTALEXTENT, 2000, 0)
'2000:控制横滚动条的范围(建议值2000-3000)
Scrollbar = GetWindowLong(List1.hwnd, GWL_STYLE)
Scrollbar = Scrollbar Or WS_HSCROLL
SetWindowLong List1.hwnd, GWL_STYLE, Scrollbar
SetWindowPos List1.hwnd, _
0, 0, 0, 0, 0, _
SWP_NOMOVE Or SWP_NOOWNERZORDER Or SWP_NOSIZE Or SWP_FRAMECHANGED
End Sub
Private Sub Form_Load()
Dim Information#, Scrollbar#
For Information = 1 To 88
List1.AddItem _
"横滚动条示范" & _
"横滚动条示范" & _
"横滚动条示范"
Next Information
Information = SendMessageLong(List1.hwnd, LB_SETHORIZONTALEXTENT, 2000, 0)
'2000:控制横滚动条的范围(建议值2000-3000)
Scrollbar = GetWindowLong(List1.hwnd, GWL_STYLE)
Scrollbar = Scrollbar Or WS_HSCROLL
SetWindowLong List1.hwnd, GWL_STYLE, Scrollbar
SetWindowPos List1.hwnd, _
0, 0, 0, 0, 0, _
SWP_NOMOVE Or SWP_NOOWNERZORDER Or SWP_NOSIZE Or SWP_FRAMECHANGED
End Sub
展开全部
只有使用API函数。
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 As Long = &H194
Private Sub Form_Load()
SendMessage List1.hwnd, LB_SETHORIZONTALEXTENT, 300, ByVal 0
End Sub
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 As Long = &H194
Private Sub Form_Load()
SendMessage List1.hwnd, LB_SETHORIZONTALEXTENT, 300, ByVal 0
End Sub
参考资料: http://www.ujx.cn/program/bbs/VB/200007/171693.html
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询