如图,网上说行数够多就会自动出现滚动条,为什么100行的ListBox还是没有滚动条呢?
1条回答 默认 最新
- 赵4老师 2022-06-24 14: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.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用