ScrollPattern.HorizontalScrollPercentProperty Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Identifies the HorizontalScrollPercent property.
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
Field Value
Examples
In the following example, a root element is passed to a function that returns the current horizontal and vertical scroll percentages of the viewable region within the content area.
///--------------------------------------------------------------------
/// <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
Remarks
This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in ScrollPatternIdentifiers.
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET