Share via


TextPane 介面

代表一個文字編輯器視窗內的窗格。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
<GuidAttribute("0A3BF283-05F8-4669-9BCB-A84B6423349A")> _
Public Interface TextPane
[GuidAttribute("0A3BF283-05F8-4669-9BCB-A84B6423349A")]
public interface TextPane
[GuidAttribute(L"0A3BF283-05F8-4669-9BCB-A84B6423349A")]
public interface class TextPane
[<GuidAttribute("0A3BF283-05F8-4669-9BCB-A84B6423349A")>]
type TextPane =  interface end
public interface TextPane

TextPane 型別會公開下列成員。

屬性

  名稱 說明
公用屬性 Collection 取得包含支援此屬性之 TextPane 物件的集合。
公用屬性 DTE 取得最上層擴充性物件。
公用屬性 Height 取得文字窗格的高度,以字元為單位。
公用屬性 Selection 取得代表 TextPane 物件目前選取範圍的物件。
公用屬性 StartPoint 取得 TextPoint 物件,表示窗格的第一個顯示字元。
公用屬性 Width 取得文字窗格的寬度,以字元為單位。
公用屬性 Window 取得 Window 物件,此物件包含已指定的窗格。

回頁首

方法

  名稱 說明
公用方法 Activate 將焦點移至目前的項目。
公用方法 IsVisible 傳回值,表示字元或指定字元在文字窗格中是否為可見。
公用方法 TryToShow 調整文字緩衝區中文字檢視的位置,如果可能的話,讓選取的文字範圍顯示在文字窗格中。您可以控制文字在窗格中的顯示位置。

回頁首

備註

您可以將一個文字編輯器視窗分割成兩個窗格。 TextPane 物件可以讓您存取每一窗格中的選取文字,以及窗格的屬性,例如高度、寬度等。

範例

Sub TextPaneExample(ByVal dte As EnvDTE.DTE)
    Dim objTW As TextWindow
    Dim objPane As TextPane
    Dim objStart As TextPoint

    objTW = dte.ActiveWindow.Object
    objPane = objTW.ActivePane
    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
public void TextPaneExample(_DTE dte)
{
    TextWindow tw;
    TextPane tpn;
    TextPoint tpt;

    tw = (TextWindow)dte.ActiveWindow.Object;
    tpn = tw.ActivePane;
    MessageBox.Show ("The active pane is " + tpn.Height.ToString () + " 
    lines high and " + tpn.Width.ToString () + " columns wide.");
    tpt = tpn.StartPoint;
    MessageBox.Show ("It begins at line " + tpt.Line.ToString () + ", 
    column " + tpt.LineCharOffset.ToString () + ".");
}

請參閱

參考

EnvDTE 命名空間