Compartilhar via


Método EditPoint2.TryToShow

Tentativas de exibir o local do ponto do texto.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (em EnvDTE80.dll)

Sintaxe

'Declaração
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

Parâmetros

  • How
    Tipo: vsPaneShowHow

    Opcional. Uma constante de vsPaneShowHow que determina como o código é exibido.

  • PointOrCount
    Tipo: Object

    Opcional. O ponto de extremidade do intervalo selecionado de texto a ser exibido. Podem ser TextPoint ou um número inteiro.

Valor de retorno

Tipo: Boolean
true se o período de ajustes de texto no editor de códigos atual; caso contrário, false.

Comentários

TryToShow ajusta o local do buffer na exibição código de forma que o intervalo indicado de texto é exibido no editor de códigos, se possível. TryToShow é semelhante ao método de Activate do objeto de TextPane exceto que tentar exibir a janela e o intervalo de texto especificado.

Exemplos

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);
}

Segurança do .NET Framework

Consulte também

Referência

EditPoint2 Interface

Namespace EnvDTE80

Outros recursos

Como compilar e executar os exemplos de código do modelo de objeto Automation