다음을 통해 공유


EditPoint2.TryToShow 메서드

텍스트 지점의 위치를 표시하려고 합니다.

네임스페이스:  EnvDTE80
어셈블리:  EnvDTE80(EnvDTE80.dll)

구문

‘선언
Function TryToShow ( _
    How As vsPaneShowHow, _
    PointOrCount As Object _
) As Boolean
bool TryToShow(
    vsPaneShowHow How,
    Object PointOrCount
)
bool TryToShow(
    [InAttribute] vsPaneShowHow How, 
    [InAttribute] Object^ PointOrCount
)
abstract TryToShow : 
        How:vsPaneShowHow * 
        PointOrCount:Object -> bool
function TryToShow(
    How : vsPaneShowHow, 
    PointOrCount : Object
) : boolean

매개 변수

  • How
    형식: vsPaneShowHow

    선택 사항 코드 표시 방법을 결정하는 vsPaneShowHow 상수입니다.

  • PointOrCount
    형식: Object

    선택 사항 선택한 텍스트 범위에서 표시할 끝점입니다. TextPoint 또는 정수가 될 수 있습니다.

반환 값

형식: Boolean
텍스트 범위가 현재 코드 편집기 내에 포함되면 true이고, 그렇지 않으면 false입니다.

설명

TryToShow는 코드 뷰의 버퍼 위치를 조정하여 가능하면 지정된 텍스트 범위가 코드 편집기에 표시되도록 합니다. TryToShow는 창을 표시하고 지정된 텍스트 범위를 표시하려고 시도한다는 점을 제외하고는 TextPane 개체의 Activate 메서드와 비슷합니다.

예제

Sub TryToShowExample(ByVal dte As DTE2)

    ' Before running this example, open a text document.
    Dim win As Window = dte.ActiveWindow
    Dim textWin As TextWindow = CType(win.Object, TextWindow)

    ' Split the text document window.
    Dim cmd As Command = dte.Commands.Item("Window.Split")
    dte.Commands.Raise(cmd.Guid, cmd.ID, Nothing, Nothing)

    ' Display the beginning of the document in the top pane and the 
    ' end of the document in the bottom pane.
    Dim sel As TextSelection = textWin.Panes.Item(2).Selection
    sel.StartOfDocument()
    sel.ActivePoint.TryToShow()
    sel = textWin.Panes.Item(1).Selection
    sel.EndOfDocument()
    sel.ActivePoint.TryToShow()

End Sub
public void TryToShowExample(DTE2 dte)
{
    // Before running this example, open a text document.
    Window win = dte.ActiveWindow;
    TextWindow textWin = (TextWindow)win.Object;

    // Split the text document window.
    Command cmd = dte.Commands.Item("Window.Split", -1);
    object dummy = null;
    dte.Commands.Raise(cmd.Guid, cmd.ID, ref dummy, ref dummy);

    // Display the beginning of the document in the top pane and the 
    // end of the document in the bottom pane.
    TextSelection sel = textWin.Panes.Item(2).Selection;
    sel.StartOfDocument(false);
    sel.ActivePoint.TryToShow(vsPaneShowHow.vsPaneShowCentered, null);
    sel = textWin.Panes.Item(1).Selection;
    sel.EndOfDocument(false);
    sel.ActivePoint.TryToShow(vsPaneShowHow.vsPaneShowCentered, null);
}

.NET Framework 보안

참고 항목

참조

EditPoint2 인터페이스

EnvDTE80 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행