IVsTextView.GetNearestPosition Method
Converts a line and column index to a text stream position.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Syntax
'Dichiarazione
Function GetNearestPosition ( _
iLine As Integer, _
iCol As Integer, _
<OutAttribute> ByRef piPos As Integer, _
<OutAttribute> ByRef piVirtualSpaces As Integer _
) As Integer
'Utilizzo
Dim instance As IVsTextView
Dim iLine As Integer
Dim iCol As Integer
Dim piPos As Integer
Dim piVirtualSpaces As Integer
Dim returnValue As Integer
returnValue = instance.GetNearestPosition(iLine, _
iCol, piPos, piVirtualSpaces)
int GetNearestPosition(
int iLine,
int iCol,
out int piPos,
out int piVirtualSpaces
)
int GetNearestPosition(
[InAttribute] int iLine,
[InAttribute] int iCol,
[OutAttribute] int% piPos,
[OutAttribute] int% piVirtualSpaces
)
abstract GetNearestPosition :
iLine:int *
iCol:int *
piPos:int byref *
piVirtualSpaces:int byref -> int
function GetNearestPosition(
iLine : int,
iCol : int,
piPos : int,
piVirtualSpaces : int
) : int
Parameters
- iLine
Type: System.Int32
[in] Integer containing the line index.
- iCol
Type: System.Int32
[in] Integer containing the column index. Viewcol coordinates might include virtual space.
- piPos
Type: System.Int32%
[out] Pointer to an integer containing the position in the text stream.
- piVirtualSpaces
Type: System.Int32%
[out] Pointer to an integer containing the number of virtual spaces.
Return Value
Type: System.Int32
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 General, All Languages, Text Editor, Options Dialog Box.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.