Compartilhar via


ITextView2.TryGetTextViewLineContainingBufferPosition Method

Definition

Attempts to get the ITextViewLine that contains the specified text buffer position.

public:
 bool TryGetTextViewLineContainingBufferPosition(Microsoft::VisualStudio::Text::SnapshotPoint bufferPosition, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Text::Formatting::ITextViewLine ^ % textViewLine);
public bool TryGetTextViewLineContainingBufferPosition (Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition, out Microsoft.VisualStudio.Text.Formatting.ITextViewLine textViewLine);
abstract member TryGetTextViewLineContainingBufferPosition : Microsoft.VisualStudio.Text.SnapshotPoint * ITextViewLine -> bool
Public Function TryGetTextViewLineContainingBufferPosition (bufferPosition As SnapshotPoint, ByRef textViewLine As ITextViewLine) As Boolean

Parameters

bufferPosition
SnapshotPoint

The text buffer position used to search for a text line.

textViewLine
ITextViewLine

Returns out the ITextViewLine requested.

Returns

True if succeeded, false otherwise.

Remarks

This method returns an ITextViewLine if it exists in the view.

If the line does not exist in the cache of formatted lines, it will be formatted and added to the cache.

The returned ITextViewLine could be invalidated by either a layout by the view or by subsequent calls to this method.

It is occasionally invalid to retrieve an ITextViewLine due to layouts or other events. Callers should be prepared to handle a failure.

Applies to