共用方式為


IVsTextView.GetLineAndColumn 方法

將列和資料行的索引中的文字資料流位置。

命名空間:  Microsoft.VisualStudio.TextManager.Interop
組件:  Microsoft.VisualStudio.TextManager.Interop (在 Microsoft.VisualStudio.TextManager.Interop.dll 中)

語法

'宣告
Function GetLineAndColumn ( _
    iPos As Integer, _
    <OutAttribute> ByRef piLine As Integer, _
    <OutAttribute> ByRef piIndex As Integer _
) As Integer
int GetLineAndColumn(
    int iPos,
    out int piLine,
    out int piIndex
)
int GetLineAndColumn(
    [InAttribute] int iPos, 
    [OutAttribute] int% piLine, 
    [OutAttribute] int% piIndex
)
abstract GetLineAndColumn : 
        iPos:int * 
        piLine:int byref * 
        piIndex:int byref -> int
function GetLineAndColumn(
    iPos : int, 
    piLine : int, 
    piIndex : int
) : int

參數

  • iPos
    類型:Int32

    [in]整數,包含文字資料流中的位置。

  • piLine
    類型:Int32%

    [] out包含對應至資料流位置的行索引的指標。

  • piIndex
    類型:Int32%

    [] out包含對應至資料流位置的資料行索引的指標。

傳回值

類型:Int32
如果此方法將會成功,則會傳回S_OK。如果失敗,它就會傳回錯誤碼。

備註

COM 簽章

從 textmgr.idl:

HRESULT IVsTextView::GetLineAndColumn(
   [in] long iPos,
   [out] long *piLine,
   [out] CharIndex *piIndex
);

您可以使用這個方法來將文字資料流位置轉換成列和資料行的索引。 若要將列和資料行的索引轉換成文字資料流位置中,使用GetNearestPositionGetNearestPosition方法在檢視中的虛擬空間的帳戶,並提供在指定的行上的行尾 (EOL) 標記的位置,若資料行為虛擬空間中,或在結束。 虛擬空間是顯示在檢視中,但如果不是的情況下的文字緩衝區的空間。 [虛擬空間] 設定是從 Tools\Options\Text Editor\All Languages\General 的存取。 如需詳細資訊,請參閱 選項,文字編輯器,所有語言

.NET Framework 安全性

請參閱

參考

IVsTextView 介面

Microsoft.VisualStudio.TextManager.Interop 命名空間