Compartir vía


ScrollPattern.ScrollPatternInformation.VerticalScrollPercent Propiedad

Definición

Obtiene la posición de desplazamiento vertical actual.

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

Valor de propiedad

Double

Posición de desplazamiento vertical como porcentaje del área total de contenido del elemento de UI Automation. El valor predeterminado es 0.0.

Ejemplos

En el ejemplo siguiente, un ScrollPattern objeto obtenido de un control de destino se pasa a una función que recupera los porcentajes de desplazamiento horizontal y vertical actuales de la región visible dentro del área de contenido.

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

Se aplica a