ScrollBar 的 Maximum 属性只能通过编程方式实现,是否有充分的理由?

发布于 2024-10-15 07:03:16 字数 938 浏览 4 评论 0原文

直观上,人们会假设最小值<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 the Maximum property
value minus the LargeChange
property value. If necessary, you can
set the Maximum property to the size
of the object -1 to account for the
term of 1.

Can you explain why this is so?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

|煩躁 2024-10-22 07:03:16

我猜测这是因为滚动条的值引用了可滚动区域显示的范围的开始。因此,如果允许用户通过用户交互滚动到其最大值,那么他们将能够将内容滚动到控件顶部。

我经常看到应用程序确实允许您滚动,直到内容的末尾经过滚动区域的顶部。 (留下一个可见的空白区域。)但直觉上,您会期望一旦到达可滚动区域的底部,滚动条就会停止。

我知道我听起来就像一个胡言乱语的疯子。希望这是有道理的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文