ScrollPattern.ScrollPatternInformation.VerticalScrollPercent 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取当前垂直滚动位置。
public:
property double VerticalScrollPercent { double get(); };
public double VerticalScrollPercent { get; }
member this.VerticalScrollPercent : double
Public ReadOnly Property VerticalScrollPercent As Double
属性值
以 UI 自动化元素内总内容区域百分比表示的垂直滚动位置。 默认值为 0.0。
示例
在下面的示例中, ScrollPattern 从目标控件获取的对象将传递到一个函数中,该函数检索内容区域中可查看区域的当前水平和垂直滚动百分比。
///--------------------------------------------------------------------
/// <summary>
/// Obtains the current scroll positions of the viewable region
/// within the content area.
/// </summary>
/// <param name="scrollPattern">
/// The ScrollPattern control pattern obtained from the
/// element of interest.
/// </param>
/// <returns>
/// The horizontal and vertical scroll percentages.
/// </returns>
///--------------------------------------------------------------------
private double[] GetScrollPercentagesFromPattern(
ScrollPattern scrollPattern)
{
if (scrollPattern == null)
{
throw new ArgumentNullException(
"ScrollPattern argument cannot be null.");
}
double[] percentage = new double[2];
percentage[0] =
scrollPattern.Current.HorizontalScrollPercent;
percentage[1] =
scrollPattern.Current.VerticalScrollPercent;
return percentage;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains the current scroll positions of the viewable region
''' within the content area.
''' </summary>
''' <param name="scrollPattern">
''' The ScrollPattern control pattern obtained from the
''' element of interest.
''' </param>
''' <returns>
''' The horizontal and vertical scroll percentages.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetScrollPercentagesFromPattern( _
ByVal scrollPattern As ScrollPattern) As Double()
If scrollPattern Is Nothing Then
Throw New ArgumentNullException( _
"ScrollPattern argument cannot be null.")
End If
Dim percentage(1) As Double
percentage(0) = scrollPattern.Current.HorizontalScrollPercent
percentage(1) = scrollPattern.Current.VerticalScrollPercent
Return percentage
End Function 'GetScrollPercentagesFromPattern