ScrollPattern.NoScroll Fält
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Anger att rullning inte ska utföras.
public: double NoScroll = -1;
public const double NoScroll = -1;
val mutable NoScroll : double
Public Const NoScroll As Double = -1
Fältvärde
Value = -1Exempel
I följande exempel hämtas ett ScrollPattern kontrollmönster från en AutomationElement och används sedan för att rulla den visningsbara regionen överst i innehållsområdet.
///--------------------------------------------------------------------
/// <summary>
/// Obtains a ScrollPattern control pattern from an automation
/// element and attempts to scroll to the top of the
/// viewfinder.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
///--------------------------------------------------------------------
private void ScrollToTop(AutomationElement targetControl)
{
if (targetControl == null)
{
throw new ArgumentNullException(
"AutomationElement argument cannot be null.");
}
ScrollPattern scrollPattern = GetScrollPattern(targetControl);
try
{
scrollPattern.SetScrollPercent(ScrollPattern.NoScroll, 0);
}
catch (InvalidOperationException)
{
// Control not able to scroll in the direction requested;
// when scrollable property of that direction is False
// TO DO: error handling.
}
catch (ArgumentOutOfRangeException)
{
// A value greater than 100 or less than 0 is passed in
// (except -1 which is equivalent to NoScroll).
// TO DO: error handling.
}
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a ScrollPattern control pattern from an automation
''' element and attempts to scroll to the top of the
''' viewfinder.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
'''--------------------------------------------------------------------
Private Sub ScrollToTop(ByVal targetControl As AutomationElement)
If targetControl Is Nothing Then
Throw New ArgumentNullException( _
"AutomationElement argument cannot be null.")
End If
Dim scrollPattern As ScrollPattern = GetScrollPattern(targetControl)
Try
scrollPattern.SetScrollPercent(ScrollPattern.NoScroll, 0)
Catch exc As InvalidOperationException
' Control not able to scroll in the direction requested;
' when scrollable property of that direction is False
' TO DO: error handling.
Catch exc As ArgumentOutOfRangeException
' A value greater than 100 or less than 0 is passed in
' (except -1 which is equivalent to NoScroll).
' TO DO: error handling.
End Try
End Sub
Kommentarer
Den här identifieraren används av UI Automation klientprogram. UI Automation providers bör använda motsvarande fält i ScrollPatternIdentifiers.
Värdet -1 kan ersättas med fältet NoScroll .