EditPoint2.TryToShow(vsPaneShowHow, Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
尝试显示文本点的位置。
bool TryToShow(EnvDTE::vsPaneShowHow How = EnvDTE.vsPaneShowHow.vsPaneShowCentered, winrt::Windows::Foundation::IInspectable const & PointOrCount);
[System.Runtime.InteropServices.DispId(50)]
public bool TryToShow (EnvDTE.vsPaneShowHow How = EnvDTE.vsPaneShowHow.vsPaneShowCentered, object PointOrCount);
[<System.Runtime.InteropServices.DispId(50)>]
abstract member TryToShow : EnvDTE.vsPaneShowHow * obj -> bool
Public Function TryToShow (Optional How As vsPaneShowHow = EnvDTE.vsPaneShowHow.vsPaneShowCentered, Optional PointOrCount As Object) As Boolean
参数
- How
- vsPaneShowHow
可选。 一个 vsPaneShowHow 常数,该常数确定代码的显示方式。
返回
如果文本的跨距在当前代码编辑器内,则为 true;否则为 false。
实现
- 属性
示例
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);
}
注解
TryToShow 在代码视图中调整缓冲区的位置,以便在代码编辑器中显示指定范围内的文本(如果可能)。 TryToShow 与 TextPane 对象的方法类似, Activate 不同之处在于,它尝试显示窗口和指定范围的文本。