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
注解
此标识符由UI 自动化客户端应用程序使用。 UI 自动化提供程序应使用等效字段。ScrollPatternIdentifiers