Share via


TextPane2 インターフェイス

テキスト エディター ウィンドウ内のペインを表します。

名前空間:  EnvDTE80
アセンブリ:  EnvDTE80 (EnvDTE80.dll 内)

構文

'宣言
<GuidAttribute("ACE19C7B-A0AC-4089-94FD-749CF4380E1F")> _
Public Interface TextPane2 _
    Inherits TextPane
[GuidAttribute("ACE19C7B-A0AC-4089-94FD-749CF4380E1F")]
public interface TextPane2 : TextPane
[GuidAttribute(L"ACE19C7B-A0AC-4089-94FD-749CF4380E1F")]
public interface class TextPane2 : TextPane
[<GuidAttribute("ACE19C7B-A0AC-4089-94FD-749CF4380E1F")>]
type TextPane2 =  
    interface
        interface TextPane
    end
public interface TextPane2 extends TextPane

TextPane2 型で公開されるメンバーは以下のとおりです。

プロパティ

  名前 説明
パブリック プロパティ Collection (TextPane から継承されます。)
パブリック プロパティ Collection このプロパティをサポートしている TextPane オブジェクトを含んでいるコレクションを取得します。
パブリック プロパティ DTE (TextPane から継承されます。)
パブリック プロパティ DTE トップレベルの機能拡張オブジェクトを取得します。
パブリック プロパティ Height (TextPane から継承されます。)
パブリック プロパティ Height テキスト ペインの高さを文字単位で取得します。
パブリック プロパティ IncrementalSearch テキスト エディターのインクリメント検索 (ISearch) 機能にアクセスできます。
パブリック プロパティ Selection (TextPane から継承されます。)
パブリック プロパティ Selection TextPane オブジェクトの現在の選択項目を表すオブジェクトを取得します。
パブリック プロパティ StartPoint (TextPane から継承されます。)
パブリック プロパティ StartPoint ペインの最初に表示された文字を表す TextPoint オブジェクトを取得します。
パブリック プロパティ Width (TextPane から継承されます。)
パブリック プロパティ Width ペインの幅を文字単位で取得します。
パブリック プロパティ Window (TextPane から継承されます。)
パブリック プロパティ Window ペインを含む Window オブジェクトを取得します。

このページのトップへ

メソッド

  名前 説明
パブリック メソッド Activate() (TextPane から継承されます。)
パブリック メソッド Activate() 現在の項目にフォーカスを移します。
パブリック メソッド IsVisible(TextPoint, Object) (TextPane から継承されます。)
パブリック メソッド IsVisible(TextPoint, Object) 文字または指定した文字列がテキスト ペイン内で表示されているかどうかを示す値を返します。
パブリック メソッド TryToShow(TextPoint, vsPaneShowHow, Object) (TextPane から継承されます。)
パブリック メソッド TryToShow(TextPoint, vsPaneShowHow, Object) 可能な場合に、指定されたテキスト範囲がテキスト ペイン内に表示されるように、テキスト バッファー内のビューの位置を調整します。ペインでのテキストの表示位置を制御できます。

このページのトップへ

解説

テキスト エディター ウィンドウは、2 つのペインに分割できます。 TextPane オブジェクトを使用すると、高さや幅などのペインのプロパティだけではなく、各ペインで選択されているテキストにアクセスできます。

この例では、テキスト ドキュメントを開き、メッセージ ボックスにいくつかのテキスト ペイン プロパティを表示します。 このアドインの例を実行する方法の詳細については、「方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する」を参照してください。

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    TextPane2Example(_applicationObject)
End Sub
Sub TextPane2Example(ByVal dte As DTE2)
    Dim objTW As TextWindow
    Dim objPane As TextPane2
    Dim objStart As TextPoint
    Dim objTextDoc As TextDocument
    Dim objTextPt As TextPoint
    Dim objEP As EditPoint
    ' Create a new text document.
    _applicationObject.ItemOperations.NewFile("General\Text File")
    ' Get a handle to the new document and create EditPoint,
    ' TextPoint, and TextPane2 objects.
    objTextDoc = CType(_applicationObject.ActiveDocument.Object _
    ("TextDocument"), TextDocument)
    objEP = objTextDoc.StartPoint.CreateEditPoint
    objTextPt = objTextDoc.StartPoint
    ' Plug in some text.
    objEP.Insert("A test sentence.")
    objTW = CType(dte.ActiveWindow.Object, TextWindow)
    objPane = CType(objTW.ActivePane, TextPane2)
    MsgBox("The active pane is " & Str(objPane.Height)  _
    & " lines high and " & Str(objPane.Width) & " columns wide.")
    objStart = objPane.StartPoint
    MsgBox("It begins at line " & Str(objStart.Line) & ", column " & _
     Str(objStart.LineCharOffset) & ".")
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    TextPane2Example(_applicationObject);
}
public void TextPane2Example(DTE2 dte)
{
    TextWindow objTW;
    TextPane2 objPane;
    TextPoint objStart;
    TextDocument objTextDoc;
    TextPoint objTextPt;
    EditPoint2 objEP;
    // Create a new text document.
    _applicationObject.ItemOperations.NewFile(@"General\Text File",
 "test.txt", Constants.vsViewKindTextView);
    // Get a handle to the text document and create EditPoint2,
    // TextPoint, and TextPane2 objects.
    objTextDoc =(TextDocument)_applicationObject.ActiveDocument.Object
("TextDocument");
    objEP = (EditPoint2)objTextDoc.StartPoint.CreateEditPoint();
    objTextPt = objTextDoc.StartPoint;
    // Plug in some text.
    objEP.Insert("A test sentence.");
    objTW = (TextWindow)_applicationObject.ActiveWindow.Object;
    objPane = (TextPane2)objTW.ActivePane;
    MessageBox.Show("The active pane is " + objPane.Height + " 
lines high and " + objPane.Width + " columns wide.");
    objStart = objPane.StartPoint;
    MessageBox.Show("It begins at line " + objStart.Line 
+ ", column " +  objStart.LineCharOffset + ".");
}

参照

参照

EnvDTE80 名前空間