다음을 통해 공유


MultipleViewPattern.MultipleViewPatternInformation.GetSupportedViews 메서드

정의

컨트롤별 보기 식별자의 컬렉션을 검색합니다.

public:
 cli::array <int> ^ GetSupportedViews();
public int[] GetSupportedViews ();
member this.GetSupportedViews : unit -> int[]
Public Function GetSupportedViews () As Integer()

반환

Int32[]

AutomationElement에서 사용할 수 있는 뷰를 식별하는 정수 값의 컬렉션입니다. 기본값은 빈 정수 배열입니다.

예제

다음 예제에서는 정수 식별자 컬렉션을 가져옵니다를 지 원하는 컨트롤에 사용할 수 있는 뷰를 나타내는 MultipleViewPattern합니다.

///--------------------------------------------------------------------
/// <summary>
/// Obtains a MultipleViewPattern control pattern from an 
/// automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A MultipleViewPattern object.
/// </returns>
///--------------------------------------------------------------------
private MultipleViewPattern GetMultipleViewPattern(
    AutomationElement targetControl)
{
    MultipleViewPattern multipleViewPattern = null;

    try
    {
        multipleViewPattern =
            targetControl.GetCurrentPattern(
            MultipleViewPattern.Pattern)
            as MultipleViewPattern;
    }
    // Object doesn't support the MultipleViewPattern control pattern
    catch (InvalidOperationException)
    {
        return null;
    }

    return multipleViewPattern;
}
'/--------------------------------------------------------------------
'/ <summary>
'/ Obtains a MultipleViewPattern control pattern from an 
'/ automation element.
'/ </summary>
'/ <param name="targetControl">
'/ The automation element of interest.
'/ </param>
'/ <returns>
'/ A MultipleViewPattern object.
'/ </returns>
'/--------------------------------------------------------------------
Private Function GetMultipleViewPattern( _
ByVal targetControl As AutomationElement) As MultipleViewPattern
    Dim multipleViewPattern As MultipleViewPattern = Nothing

    Try
        multipleViewPattern = DirectCast( _
        targetControl.GetCurrentPattern(multipleViewPattern.Pattern), _
        MultipleViewPattern)
    Catch exc As InvalidOperationException
        'Object doesn't support the MultipleViewPattern control pattern
        Return Nothing
    End Try

    Return multipleViewPattern
End Function 'GetMultipleViewPattern
///--------------------------------------------------------------------
/// <summary>
/// Gets the collection of currently supported views from a target.
/// </summary>
/// <param name="multipleViewPattern">
/// The MultipleViewPattern obtained from a multiple view control.
/// </param>
/// <returns>
/// A collection of identifiers representing the supported views.
/// </returns>
///--------------------------------------------------------------------
private int[] GetSupportedViewsFromControl(
    MultipleViewPattern multipleViewPattern)
{
    if (multipleViewPattern == null)
    {
        throw new ArgumentNullException(
            "MultipleViewPattern parameter must not be null.");
    }

    return multipleViewPattern.Current.GetSupportedViews();
}
'/--------------------------------------------------------------------
'/ <summary>
'/ Gets the collection of currently supported views from a target.
'/ </summary>
'/ <param name="multipleViewPattern">
'/ The MultipleViewPattern obtained from a multiple view control.
'/ </param>
'/ <returns>
'/ A collection of identifiers representing the supported views.
'/ </returns>
'/--------------------------------------------------------------------
Private Function GetSupportedViewsFromControl( _
ByVal multipleViewPattern As MultipleViewPattern) As Integer()
    If multipleViewPattern Is Nothing Then
        Throw New ArgumentNullException( _
        "MultipleViewPattern parameter must not be null.")
    End If

    Return multipleViewPattern.Current.GetSupportedViews()

End Function 'GetSupportedViewsFromControl

설명

뷰 식별자의 컬렉션은 인스턴스 간에 동일 합니다.

뷰 식별자 값을 전달할 수 GetViewName입니다.

적용 대상