设置滚动条的拇指大小

设置滚动条的拇指大小

本文介绍了设置滚动条的拇指大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试计算与WPF Scrollbar thumb元素的大小相关的算法.

I am attempting to work out the algorithm associated with sizing of the WPF Scrollbar thumb element.

可以使用Scrollbar.ViewportSize属性调整thumb元素的大小,但它又与Scrollbar.MinimumScrollbar.Maximum值相关.

The thumb element can be sized using the Scrollbar.ViewportSize property, but it in turn is related to the Scrollbar.Minimum and Scrollbar.Maximum values.

到目前为止,我发现的是:

What I have discovered so far is:

对于最小和最大 0 10 ,视口大小为:

For a Minimum and Maximum of 0 and 10, a ViewportSize of:

0-拇指的最小大小
5-拇指大约占可用曲目的25%
10-拇指大约占可用曲目的50%
100-略过可用曲目的75%
1000-拇指大约占可用曲目的90%
10000-拇指会填充可用的曲目.

0 - Thumb minimum size
5 - Thumb approximately 25% of the available track
10 - Thumb approximately 50% of the available track
100 - Thumb approximately 75% of the available track
1000 - Thumb approximately 90% of the available track
10000 - Thumb fills the available track.

[注意:这些数字仅来自于我的反复试验!]

[note: these figures are only from my rough trial and error!]

理想情况下,我希望能够有一个算法,其中给定滚动条的最小值和最大值,我可以将拇指大小设置为恰好是可用轨道的x%.

Ideally I'd like to be able to have an algorithm where given the minimum and maximum values for the Scrollbar I can set the thumb size to be exactly x% of the available track.

任何人都可以帮忙吗?

谢谢.

推荐答案

来自: http://msdn.microsoft.com/zh-CN/library/system.windows.controls.primitives.track(VS.90).aspx

或重新排列viewportSize:

or re-arranging for viewportSize:

您可能已经发现了这个问题,但是以为我可以发帖,以防其他人到此结束.

You've prob found this already but thought I'd post in case others end up here.

这篇关于设置滚动条的拇指大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 07:18