共用方式為


IVsTextManager.NavigateToLineAndColumn Method

Definition

Finds or creates an appropriate view on the specified buffer and places the selection at the specified location.

public:
 int NavigateToLineAndColumn(Microsoft::VisualStudio::TextManager::Interop::IVsTextBuffer ^ pBuffer, Guid % guidDocViewType, int iStartRow, int iStartIndex, int iEndRow, int iEndIndex);
public int NavigateToLineAndColumn (Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iStartRow, int iStartIndex, int iEndRow, int iEndIndex);
abstract member NavigateToLineAndColumn : Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer * Guid * int * int * int * int -> int
Public Function NavigateToLineAndColumn (pBuffer As IVsTextBuffer, ByRef guidDocViewType As Guid, iStartRow As Integer, iStartIndex As Integer, iEndRow As Integer, iEndIndex As Integer) As Integer

Parameters

pBuffer
IVsTextBuffer

[in] Pointer to the IVsTextBuffer interface.

guidDocViewType
Guid

[in] GUID identifying the view. This value should always be LOGVIEWID_TextView.

iStartRow
Int32

[in] Starting line for the selection to locate.

iStartIndex
Int32

[in] Starting index for the selection to locate.

iEndRow
Int32

[in] Ending line for the selection to locate.

iEndIndex
Int32

[in] Ending index for the selection to locate.

Returns

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

Remarks

COM Signature

From textmgr.idl:

HRESULT IVsTextManager::NavigateToLineAndColumn(  
   [in] IVsTextBuffer* pBuffer,  
   [in] REFGUID guidDocViewType,  
   [in] long iStartRow,  
   [in] CharIndex iStartIndex,  
   [in] long iEndRow,  
   [in] CharIndex iEndIndex  
);  

To use this method, pass in a pointer to a text buffer and a line/column position in that buffer. The method then locates the buffer, displays a view if the view is not currently active, and then places selection at the specified span of text.

Applies to