共用方式為


ITextView.GetTextViewLineContainingBufferPosition Method

Gets the ITextViewLine that contains the specified text buffer position.

Namespace:  Microsoft.VisualStudio.Text.Editor
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

Syntax

'宣告
Function GetTextViewLineContainingBufferPosition ( _
    bufferPosition As SnapshotPoint _
) As ITextViewLine
ITextViewLine GetTextViewLineContainingBufferPosition(
    SnapshotPoint bufferPosition
)
ITextViewLine^ GetTextViewLineContainingBufferPosition(
    SnapshotPoint bufferPosition
)
abstract GetTextViewLineContainingBufferPosition : 
        bufferPosition:SnapshotPoint -> ITextViewLine 
function GetTextViewLineContainingBufferPosition(
    bufferPosition : SnapshotPoint
) : ITextViewLine

Parameters

Return Value

Type: Microsoft.VisualStudio.Text.Formatting.ITextViewLine
The ITextViewLine that contains the specified buffer position.

Exceptions

Exception Condition
InvalidOperationException

The view has not completed initialization.

ArgumentOutOfRangeException

bufferPosition is not a valid buffer position.

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.

.NET Framework Security

See Also

Reference

ITextView Interface

Microsoft.VisualStudio.Text.Editor Namespace