Condividi tramite


IVsTextView.GetNearestPosition(Int32, Int32, Int32, Int32) Method

Definition

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

public:
 int GetNearestPosition(int iLine, int iCol, [Runtime::InteropServices::Out] int % piPos, [Runtime::InteropServices::Out] int % piVirtualSpaces);
int GetNearestPosition(int iLine, int iCol, [Runtime::InteropServices::Out] int & piPos, [Runtime::InteropServices::Out] int & piVirtualSpaces);
public int GetNearestPosition (int iLine, int iCol, out int piPos, out int piVirtualSpaces);
abstract member GetNearestPosition : int * int * int * int -> int
Public Function GetNearestPosition (iLine As Integer, iCol As Integer, ByRef piPos As Integer, ByRef piVirtualSpaces As Integer) As Integer

Parameters

iLine
Int32

[in] Integer containing the line index.

iCol
Int32

[in] Integer containing the column index. Viewcol coordinates might include virtual space.

piPos
Int32

[out] Pointer to an integer containing the position in the text stream.

piVirtualSpaces
Int32

[out] Pointer to an integer containing the number of virtual spaces.

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::GetNearestPosition(  
   [in] long iLine,  
   [in] ViewCol iCol,  
   [out] long *piPos,  
   [out] long *piVirtualSpaces  
);  

Use this method to convert a line and column index to a text stream position. To convert from a stream position to a line and column index, use GetLineAndColumn. 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