다음을 통해 공유


IVsTextView.GetLineAndColumn(Int32, Int32, Int32) Method

Definition

Converts a text stream position to a line and column index.

public:
 int GetLineAndColumn(int iPos, [Runtime::InteropServices::Out] int % piLine, [Runtime::InteropServices::Out] int % piIndex);
int GetLineAndColumn(int iPos, [Runtime::InteropServices::Out] int & piLine, [Runtime::InteropServices::Out] int & piIndex);
public int GetLineAndColumn (int iPos, out int piLine, out int piIndex);
abstract member GetLineAndColumn : int * int * int -> int
Public Function GetLineAndColumn (iPos As Integer, ByRef piLine As Integer, ByRef piIndex As Integer) As Integer

Parameters

iPos
Int32

[in] Integer containing the position in the text stream.

piLine
Int32

[out] Pointer containing the line index corresponding to the stream position.

piIndex
Int32

[out] Pointer containing the column index corresponding to the stream position.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From textmgr.idl:

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

Use this method to convert a text stream position to a line and column index. To convert a line and column index to a text stream position, use GetNearestPosition. The GetNearestPosition method accounts for virtual space in the view and provides the position of the end-of-line (EOL) marker on the given line if the column is in virtual space or at the end. Virtual space is space that shows in the view but if not part of the text buffer. The virtual space setting is access from Tools\Options\Text Editor\All Languages\General. For more information, see Options, Text Editor, All Languages.

Applies to