다음을 통해 공유


ScrollPattern.NoScroll 필드

정의

스크롤이 수행되지 않도록 지정합니다.

public: double NoScroll = -1;
public const double NoScroll = -1;
val mutable NoScroll : double
Public Const NoScroll As Double  = -1

필드 값

Value = -1

예제

다음 예제에서는 ScrollPattern 컨트롤 패턴에서 가져온는 AutomationElement 을 사용 하는 콘텐츠 영역의 맨 위에 표시 가능 영역을 스크롤합니다.

///--------------------------------------------------------------------
/// <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

설명

이 식별자는 UI 자동화 클라이언트 애플리케이션에서 사용 됩니다. UI 자동화 공급자의 해당 필드를 사용 해야 ScrollPatternIdentifiers합니다.

-1 값 대신 사용할 수는 NoScroll 필드입니다.

적용 대상