共用方式為


IVsTextManager.NavigateToPosition(IVsTextBuffer, Guid, Int32, Int32) Method

Definition

Finds or creates an appropriate view on the specified buffer and puts the selection on the specified linear position.

public:
 int NavigateToPosition(Microsoft::VisualStudio::TextManager::Interop::IVsTextBuffer ^ pBuffer, Guid % guidDocViewType, int iPos, int iLen);
public int NavigateToPosition (Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer pBuffer, ref Guid guidDocViewType, int iPos, int iLen);
abstract member NavigateToPosition : Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer * Guid * int * int -> int
Public Function NavigateToPosition (pBuffer As IVsTextBuffer, ByRef guidDocViewType As Guid, iPos As Integer, iLen 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.

iPos
Int32

[in] Linear position in buffer on which to put the caret.

iLen
Int32

[in] Length of selection.

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::NavigateToPosition(  
   [in] IVsTextBuffer * pBuffer,  
   [in] REFGUID guidDocViewType,  
   [in] long iPos,  
   [in] long iLen  
);  

This method is the same as NavigateToLineAndColumn, except that it uses one-dimensional, positional coordinates.

Applies to