| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2537 人关注过本帖
标题:ListBox横向滚动条
取消只看楼主 加入收藏
三断笛
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:31
帖 子:1621
专家分:1617
注 册:2007-5-24
结帖率:37.5%
收藏
 问题点数:0 回复次数:0 
ListBox横向滚动条
有朋友问到ListBox横向滚动条,百度上有答案,现在把这个单独发个帖子出来,有兴趣的看看
程序代码:
 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
   (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
   (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowPos Lib "user32" _
   (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
    ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
    ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
   (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, ByVal lParam As Long) As Long
     'api声明
    
Private Const GWL_STYLE = (-16)
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_NOCOPYBITS = &H100
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOOWNERZORDER = &H200
Private Const SWP_NOREDRAW = &H8
Private Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_FRAMECHANGED = &H20
Private Const WS_HSCROLL = &H100000
Private Const LB_SETHORIZONTALEXTENT = &H194
Private Const LB_GETHORIZONTALEXTENT = &H193
      '常量声明


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



[[it] 本帖最后由 三断笛 于 2008-5-29 02:38 编辑 [/it]]
搜索更多相关主题的帖子: ListBox 滚动 
2008-05-29 02:35
快速回复:ListBox横向滚动条
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039589 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved