共用方式為


EditPoint.Line 屬性

取得 EditPoint 物件的行號。

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

語法

'宣告
ReadOnly Property Line As Integer
    Get
int Line { get; }
property int Line {
    int get ();
}
abstract Line : int
function get Line () : int

屬性值

型別:System.Int32
EditPoint 物件的行號。

實作

TextPoint.Line

備註

行號從 1 開始。

範例

Public Sub Example(ByVal dte As DTE2) 
    Try
        ' Open a text document before running this example.
        Dim objTD, objTD2 As TextDocument
        Dim objEP As EditPoint
        
        objTD = dte.ActiveDocument.Object("TextDocument")
        objEP = objTD.StartPoint.CreateEditPoint()
        objEP.Insert("Hello ")
        'Show line number at editpoint.
        MessageBox.Show("EditPoint is at line #: " + objEP.Line.ToString)
        objTD2 = objEP.Parent
        MessageBox.Show(objTD2.Type)
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try
End Sub
public void Example(DTE2 dte)
{
   try
   {
      // Open a text document before running this example.
      TextDocument objTD, objTD2;
      EditPoint objEP;

      objTD = (TextDocument)dte.ActiveDocument.Object("TextDocument");
      objEP = (EditPoint)objTD.StartPoint.CreateEditPoint();
      objEP.Insert("Hello ");
      //Show line number at editpoint.
      MessageBox.Show("EditPoint is at line #: " + objEP.Line);
      objTD2 = objEP.Parent;
      MessageBox.Show(objTD2.Type);
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}

.NET Framework 安全性

請參閱

參考

EditPoint 介面

Line 多載

EnvDTE 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例