EditPoint2.TryToShow 方法 (vsPaneShowHow, Object)

尝试显示文本点的位置。

命名空间:  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

参数

  • PointOrCount
    类型:System.Object
    可选。要显示的文本的选定范围的终结点。可以是 TextPoint 或一个整数。

返回值

类型:System.Boolean
如果文本的跨距在当前代码编辑器内,则为 true;否则为 false。

实现

EditPoint.TryToShow(vsPaneShowHow, Object)

备注

如果可能,TryToShow 将调整代码视图中缓冲区的位置,以便在代码编辑器中显示指示的文本范围。 TryToShowTextPane 对象的 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 接口

TryToShow 重载

EnvDTE80 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例