ScrollPattern.VerticalScrollPercentProperty 字段
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
标识 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
字段值
示例
在下面的示例中,将根元素传递给一个函数,该函数返回内容区域中可查看区域的当前滚动百分比。
///--------------------------------------------------------------------
/// <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