ScrollPattern.HorizontalScrollPercentProperty 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
識別 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
欄位值
範例
在下列範例中,根項目會傳遞至函式,以傳回內容區域內可檢視區域的目前水準和垂直捲動百分比。
///--------------------------------------------------------------------
/// <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 對等欄位。