反转窗口形成垂直滚动条
我正在制作一个 winforms 应用程序 c#。垂直滚动条最小值位于顶部,最大值位于底部,向下滚动增加值,反之亦然。有没有办法把它倒过来,让上面的更高,下面的更低。
I'm making a winforms app c#. The vertical scroll bar min value is at the top and max at the bottom, and scrolling down increases the value and vice versa. Is there a way to invert it, so that up is higher and down is lower.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您实际上无法仅通过查看来“看到”滚动条的值,因此,换句话说,将 min 放在顶部、将 max 放在底部、然后将其放置在顶部之间没有实际区别只是在访问时反转该值:
当然,您也可以重写
VScrollBar
类并添加您自己的“反转值”属性:请注意,Maximum 仍然必须更大 配置时大于最小值。
You cannot actually "see" the value of the scroll bar just by looking at it, so, in other words, there is no actual difference between having min at the top, max at the bottom, and then just inverting the value when you access it:
Of course, you can also override the
VScrollBar
class and add your own "inverted value" property:Note that Maximum still has to be larger than Minimum when configuring it.
ScrollBar 的 Value 属性返回的值从
scrollBar.Minimum
到scrollBar.Maximum -scrollBar.LargeChange
。因此,如果滚动条的最小值为 5,最大值为 15,LargeChange(滚动范围的可见部分)为 3,则可能的返回值从 5 到 12。
因此,要反转该值,您可以实际上想要使用:(
通常您可以将值视为拇指的左边缘或上边缘的位置。上面的公式将为您提供拇指的下边缘。如果您仍然想要上边缘(即从 8 开始的值)到上例中的 15),然后使用:
The values returned by the Value property of a ScrollBar go from
scrollBar.Minimum
toscrollBar.Maximum - scrollBar.LargeChange
.Thus if a scroll bar has Minimum of 5, Maximum of 15, and LargeChange (which doubles as the visible portion of the scrolling range) is 3, then the possible return values go from 5 to 12.
So, to invert the value, you actually want to use:
(Normally you can think of Value as position of the left or top edge of the thumb. The formula above will give you the bottom edge of the thumb. If you still want the top edge (i.e. values going from 8 to 15 in the example above), then use: