Bonjir 2022-06-24 02:19 采纳率: 71.4%
浏览 12
已结题

vc怎样创造一个有垂直滚动条的ListBox?

img

如图,网上说行数够多就会自动出现滚动条,为什么100行的ListBox还是没有滚动条呢?

  • 写回答

1条回答 默认 最新

  • 赵4老师 2022-06-24 06:18
    关注

    WS_VSCROLL and WS_HSCROLL
    When either or both of these styles are specified for a list box, scroll bars are created for the list box.

    A vertical scroll bar is displayed when there are more items in a list box without the LBS_MULTICOLUMN style than can be displayed at one time. Without a scroll style (WS_VSCROLL or WS_HSCROLL), the list box will not display a vertical scroll bar, although the list box still scrolls when the user uses the mouse or keyboard. List boxes with the LBS_MULTICOLUMN style cannot scroll vertically, so no vertical scroll bar is displayed.

    A horizontal scroll bar is used by a list box on these occasions:

    When the list box has the LBS_MULTICOLUMN style, and there are more items than can be displayed at one time, the list box scrolls the columns horizontally. If the list box does not have the WS_HSCROLL or WS_VSCROLL style, the user can scroll the list box horizontally only by using the keyboard. A horizontal scroll bar is required to allow the user to scroll an LBS_MULTICOLUMN list box with a mouse.

    When a list box does not have the LBS_MULTICOLUMN style and the list box client window is narrower than the horizontal extent of the list box, a horizontal scroll bar is needed to scroll through the entire horizontal extent. The application must set the horizontal extent of the list box by sending the list box an LB_SETHORIZONTALEXTENT message. Without the horizontal extent set by the application, no horizontal scroll bar is displayed. See the "Considerations for Horizontal Scroll Bars in List Boxes" article in the MSDN Library for a complete discussion of horizontal scroll bars on list boxes.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
    Bonjir 2022-06-24 10:41

    十分感谢解答,问题解决了。
    能否问一下,您的这篇文字是在哪里看到的呢?我也希望能了解到这样的平台

    回复
    赵4老师 回复 Bonjir 2022-06-24 13:45
    2
    回复
编辑
预览

报告相同问题?

问题事件

  • 系统已结题 7月1日
  • 已采纳回答 6月24日
  • 创建了问题 6月24日
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部