ScrollPattern.ScrollPatternInformation.VerticalScrollPercent Property

Definition

Получает текущую позицию вертикальной полосы прокрутки.Gets the current vertical scroll position.

public:
 property double VerticalScrollPercent { double get(); };
public double VerticalScrollPercent { get; }
member this.VerticalScrollPercent : double
Public ReadOnly Property VerticalScrollPercent As Double

Property Value

Double

Позиция вертикальной прокрутки в виде процента от общего размера области содержимого в элементе автоматизации пользовательского интерфейса.The vertical scroll position as a percentage of the total content area within the UI Automation element. Значение по умолчанию — 0,0.The default value is 0.0.

Examples

В следующем примере объект ScrollPattern, полученный из целевого элемента управления, передается в функцию, которая получает текущий процент горизонтальной и вертикальной прокрутки видимой области в области содержимого.In the following example, a ScrollPattern object obtained from a target control is passed into a function that retrieves the current horizontal and vertical scroll percentages of the viewable region within the content area.

///--------------------------------------------------------------------
/// <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

Applies to