Compartilhar via


ScrollPattern.HorizontalScrollPercentProperty Campo

Definição

Identifica a propriedade HorizontalScrollPercent.

public: static initonly System::Windows::Automation::AutomationProperty ^ HorizontalScrollPercentProperty;
public static readonly System.Windows.Automation.AutomationProperty HorizontalScrollPercentProperty;
 staticval mutable HorizontalScrollPercentProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly HorizontalScrollPercentProperty As AutomationProperty 

Valor do campo

AutomationProperty

Exemplos

No exemplo a seguir, um elemento raiz é passado para uma função que retorna os percentuais de rolagem horizontal e vertical atuais da região visível dentro da área de conteúdo.

///--------------------------------------------------------------------
/// <summary>
/// Obtains the current scroll positions of the viewable region 
/// within the content area.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// The horizontal and vertical scroll percentages.
/// </returns>
///--------------------------------------------------------------------
private double[] GetScrollPercentages(AutomationElement targetControl)
{
    if (targetControl == null)
    {
        throw new ArgumentNullException(
            "AutomationElement argument cannot be null.");
    }

    double[] percentage = new double[2];

    percentage[0] =
        (double)targetControl.GetCurrentPropertyValue(
        ScrollPattern.HorizontalScrollPercentProperty);

    percentage[1] =
         (double)targetControl.GetCurrentPropertyValue(
         ScrollPattern.VerticalScrollPercentProperty);

    return percentage;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains the current scroll positions of the viewable region 
''' within the content area.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' The horizontal and vertical scroll percentages.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetScrollPercentages( _
ByVal targetControl As AutomationElement) As Double()
    If targetControl Is Nothing Then
        Throw New ArgumentNullException( _
        "AutomationElement argument cannot be null.")
    End If

    Dim percentage(1) As Double

    percentage(0) = System.Convert.ToDouble( _
    targetControl.GetCurrentPropertyValue( _
    ScrollPattern.HorizontalScrollPercentProperty))

    percentage(1) = System.Convert.ToDouble( _
    targetControl.GetCurrentPropertyValue( _
    ScrollPattern.VerticalScrollPercentProperty))

    Return percentage

End Function 'GetScrollPercentages

Comentários

Esse identificador é usado por aplicativos cliente Automação da Interface do Usuário. Automação da Interface do Usuário provedores devem usar o campo equivalente em ScrollPatternIdentifiers.

Aplica-se a

Confira também