IVsTextView.GetCaretPos 方法

返回光标位置的行和列索引。

命名空间:  Microsoft.VisualStudio.TextManager.Interop
程序集:  Microsoft.VisualStudio.TextManager.Interop(在 Microsoft.VisualStudio.TextManager.Interop.dll 中)

语法

声明
Function GetCaretPos ( _
    <OutAttribute> ByRef piLine As Integer, _
    <OutAttribute> ByRef piColumn As Integer _
) As Integer
int GetCaretPos(
    out int piLine,
    out int piColumn
)
int GetCaretPos(
    [OutAttribute] int% piLine, 
    [OutAttribute] int% piColumn
)
abstract GetCaretPos : 
        piLine:int byref * 
        piColumn:int byref -> int
function GetCaretPos(
    piLine : int, 
    piColumn : int
) : int

参数

  • piLine
    类型:Int32%

    [out] 对包含行的整数的指针,因此,如果方法成功。

  • piColumn
    类型:Int32%

    [out] 设置为包含列的整数的指针,因此,如果方法成功。 Viewcol 坐标可以包括虚拟空间。

返回值

类型:Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。

备注

COM 签名

从 textmgr.idl:

HRESULT IVsTextView::GetCaretPos(
   [out] long *piLine,
   [out] ViewCol *piColumn
);

插入符号位置是光标位置。 使用 GetCaretPos 管理插入符号或插入点。 ,如果只有一个是必需的, piLine 或 piColumn 参数可以是 nullnull 引用(在 Visual Basic 中为 Nothing) 。

.NET Framework 安全性

请参阅

参考

IVsTextView 接口

Microsoft.VisualStudio.TextManager.Interop 命名空间