EditPoint.TryToShow 方法 (vsPaneShowHow, Object)
嘗試顯示文字點的位置。
命名空間: EnvDTE
組件: EnvDTE (在 EnvDTE.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
型別:EnvDTE.vsPaneShowHow
選擇項。vsPaneShowHow 常數,決定如何顯示程式碼。
- PointOrCount
型別:System.Object
選擇項。要顯示之文字選取範圍的結束點。可能為 TextPoint 或整數。
傳回值
型別:System.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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。