Winforms - 调整 CheckedListBox 上垂直滚动条的宽度
我的表单上有一个 CheckListBox,但我想使滚动条更宽,因为用户使用的是触摸屏而不是鼠标。
如何更改滚动条宽度?
编辑:我说的是垂直滚动条的宽度
I have a CheckListBox on my form but I want to make the scrollbar wider as users are using touch screens not a mouse.
How can I change the scroll bar width?
EDIT: I am talking about the width of the vertical scrollbar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要更改滚动条的物理大小,请参阅此。
这来自以下页面:ListBox 中的水平滚动条。我针对 Winforms 修改了它,它对我有用:
To change the physical size of the scrollbar, see this.
This came from the following page: Horizontal Scrollbar in ListBox. I modified it for Winforms and it worked for me:
以下代码使用 SPI_SETNONCLIENTMETRICS 更改滚动条宽度的系统范围设置。请注意,它将更改系统上的所有应用程序,而不仅仅是单个应用程序。您可能应该将其作为配置项,以便在需要时可以将宽度更改回默认值。
然后您可以使用此代码查看滚动条宽度的当前值
然后您可以使用此代码更改滚动条的大小...
The following code makes use of SPI_SETNONCLIENTMETRICS to change the system wide setting for the scrollbar width. NOTE that it will change all applications on the system not just a single one. You should probably make this a configuration item so that you can change the width back to a default if you need to.
You can then use this code to see the current value for the scrollbar width
You can then use this code to change the size of the scrollbar...
您只能通过创建自定义 CLB 控件并重写 OnPaint 事件来做到这一点。
编辑:好的,仍然非常基本,但是 CodeProject 上的这篇文章可能会帮助您: http:// /www.codeproject.com/KB/miscctrl/cutebutton.aspx
编辑 2:您可能喜欢以下自定义滚动条示例:http://www.codeproject.com/KB/miscctrl/MotifScrollBars.aspx
You can only do that by creating a custom CLB control and overriding the OnPaint event.
Edit: Ok, still very basic, but this article on CodeProject might help you: http://www.codeproject.com/KB/miscctrl/cutebutton.aspx
Edit 2: You might like the following example of a customized scrollbar: http://www.codeproject.com/KB/miscctrl/MotifScrollBars.aspx