ScrollBar 的 Maximum 属性只能通过编程方式实现,是否有充分的理由?
直观上,人们会假设最小值<
ScrollBar 的 /code> 和
Maximum
属性 可用于控制用户可访问的范围,但 Maximum
的 MSDN 文章 指出:
您可以考虑调整 动态匹配的
Maximum
属性 滚动条父级的大小 与像素大小或与 显示的行数。只能达到最大值 以编程方式。的值 滚动条无法达到最大值 通过运行时的用户交互实现价值 时间。可以取的最大值 通过用户交互达到的目的是 等于 1 加上
Maximum
属性 值减去LargeChange
财产价值。如果有需要,您可以 将Maximum
属性设置为大小 对象 -1 来解释 项为 1。
你能解释一下为什么会这样吗?
Intuitively one would assume that the Minimum
and Maximum
properties of ScrollBar can be used to control its range accessible by the user, but Maximum
's MSDN article states:
You might consider adjusting the
Maximum
property dynamically to match
the size of the scroll bar's parent in
proportion to pixel size or to the
number of rows or lines displayed.The maximum value can only be reached
programmatically. The value of a
scroll bar cannot reach its maximum
value through user interaction at run
time. The maximum value that can be
reached through user interaction is
equal to 1 plus theMaximum
property
value minus theLargeChange
property value. If necessary, you can
set theMaximum
property to the size
of the object -1 to account for the
term of 1.
Can you explain why this is so?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜测这是因为滚动条的值引用了可滚动区域显示的范围的开始。因此,如果允许用户通过用户交互滚动到其最大值,那么他们将能够将内容滚动到控件顶部。
我经常看到应用程序确实允许您滚动,直到内容的末尾经过滚动区域的顶部。 (留下一个可见的空白区域。)但直觉上,您会期望一旦到达可滚动区域的底部,滚动条就会停止。
我知道我听起来就像一个胡言乱语的疯子。希望这是有道理的。
I'm guessing that this is because the value of the scroll bar refers to the start of the range displayed by the scrollable area. So if the user were allowed to scroll to its maximum value via user interaction, then they would be able to scroll the content off the top of the control.
Often times I've seen applications that do allow you to scroll until the end of the content passes the top of the scrolling region. (Leaving a blank region visible.) But intuitively you'd expect that the scroll bar would stop you once the you've reached the bottom of the scrollable region.
I know I just sound like a raving lunatic. Hopefully it made some sense.