MultipleViewPattern.GetViewName(Int32) 메서드

정의

컨트롤별 뷰 이름을 검색합니다.Retrieves the name of a control-specific view.

public:
 System::String ^ GetViewName(int viewId);
public string GetViewName (int viewId);
member this.GetViewName : int -> string
Public Function GetViewName (viewId As Integer) As String

매개 변수

viewId
Int32

컨트롤별 뷰 식별자입니다.The control-specific view identifier.

반환

컨트롤별 뷰 이름을 나타내는 지역화된 문자열입니다.A localized string representing the control-specific view name.

예외

viewId가 지원되는 뷰 컬렉션의 멤버가 아닌 경우.viewId is not a member of the supported views collection.

예제

다음 예제에서는 현재 보기의 컨트롤별 이름을 지 원하는 컨트롤에서 검색 됩니다 MultipleViewPattern합니다.In the following example, the control-specific name of the current view is retrieved from a control that supports MultipleViewPattern.

///--------------------------------------------------------------------
/// <summary>
/// Gets the name of the current view of a target.
/// </summary>
/// <param name="multipleViewControl">
/// The current multiple view control.
/// </param>
/// <returns>
/// The current view name.
/// </returns>
///--------------------------------------------------------------------
private string ViewName(AutomationElement multipleViewControl)
{
    if (multipleViewControl == null)
    {
        throw new ArgumentNullException(
            "AutomationElement parameter must not be null.");
    }

    // Get a MultipleViewPattern from the current control.
    MultipleViewPattern multipleViewPattern =
        GetMultipleViewPattern(multipleViewControl);

    if (multipleViewControl != null)
    {
        try
        {
            int viewID = 
                (int)multipleViewControl.GetCurrentPropertyValue(
                MultipleViewPattern.CurrentViewProperty);
            return multipleViewPattern.GetViewName(viewID);
        }
        catch (ArgumentException)
        {
            // TO DO: error handling
        }
    }
    return null;
}
'/--------------------------------------------------------------------
'/ <summary>
'/ Gets the name of the current view of a target.
'/ </summary>
'/ <param name="multipleViewControl">
'/ The current multiple view control.
'/ </param>
'/ <returns>
'/ The current view name.
'/ </returns>
'/--------------------------------------------------------------------
Private Function ViewName( _
ByVal multipleViewControl As AutomationElement) As String
    If multipleViewControl Is Nothing Then
        Throw New ArgumentNullException( _
        "AutomationElement parameter must not be null.")
    End If

    If Not (multipleViewControl Is Nothing) Then
        Try
            ' Get a MultipleViewPattern from the current control.
            Dim multipleViewPattern As MultipleViewPattern = _
            GetMultipleViewPattern(multipleViewControl)
            Dim viewID As Integer = _
            DirectCast(multipleViewControl.GetCurrentPropertyValue( _
            multipleViewPattern.CurrentViewProperty), Integer)
            Return multipleViewPattern.GetViewName(viewID)
        Catch exc As ArgumentException
            ' TO DO: error handling
        End Try
    End If
    Return Nothing
End Function 'ViewName

설명

뷰 식별자를 사용 하 여 검색할 수 GetSupportedViews입니다.View identifiers can be retrieved by using GetSupportedViews.

컨트롤별 보기 식별자 컬렉션 인스턴스에서 동일 합니다.The control-specific collection of view identifiers is identical across instances.

뷰 이름은 텍스트 읽어주기, 브라유 점자 및 기타 액세스할 수 있는 애플리케이션에 적합 합니다.View names are suitable for use in Text to Speech, Braille, and other accessible applications.

적용 대상