共用方式為


ScrollPattern.VerticalScrollPercentProperty 欄位

定義

識別 VerticalScrollPercent 屬性。

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

欄位值

AutomationProperty

範例

在下列範例中,根項目會傳遞至函式,以傳回內容區域內可檢視區域的目前捲動百分比。

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

備註

消費者介面自動化用戶端應用程式會使用此識別碼。 消費者介面自動化提供者應該使用 中的 ScrollPatternIdentifiers 對等欄位。

適用於

另請參閱