次の方法で共有


EditPoint.TryToShow メソッド

テキスト ポイントの位置の表示を試みます。

名前空間:  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

パラメーター

  • 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 セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

EditPoint インターフェイス

EnvDTE 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する