EditPoint.Line 属性
获取 EditPoint 对象的行号。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
ReadOnly Property Line As Integer
int Line { get; }
property int Line {
int get ();
}
abstract Line : int with get
function get Line () : int
属性值
类型:Int32
EditPoint 对象的行号。
备注
行编号从 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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。