Partilhar via


ITextView.DisplayTextLineContainingBufferPosition Method (SnapshotPoint, Double, ViewRelativePosition, Nullable<Double>, Nullable<Double>)

Formats and displays the contents of the text buffer so that the ITextViewLine containing the specified buffer position is displayed at the desired position.

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

Syntax

'Declaração
Sub DisplayTextLineContainingBufferPosition ( _
    bufferPosition As SnapshotPoint, _
    verticalDistance As Double, _
    relativeTo As ViewRelativePosition, _
    viewportWidthOverride As Nullable(Of Double), _
    viewportHeightOverride As Nullable(Of Double) _
)
void DisplayTextLineContainingBufferPosition(
    SnapshotPoint bufferPosition,
    double verticalDistance,
    ViewRelativePosition relativeTo,
    Nullable<double> viewportWidthOverride,
    Nullable<double> viewportHeightOverride
)
void DisplayTextLineContainingBufferPosition(
    SnapshotPoint bufferPosition, 
    double verticalDistance, 
    ViewRelativePosition relativeTo, 
    Nullable<double> viewportWidthOverride, 
    Nullable<double> viewportHeightOverride
)
abstract DisplayTextLineContainingBufferPosition : 
        bufferPosition:SnapshotPoint * 
        verticalDistance:float * 
        relativeTo:ViewRelativePosition * 
        viewportWidthOverride:Nullable<float> * 
        viewportHeightOverride:Nullable<float> -> unit 
function DisplayTextLineContainingBufferPosition(
    bufferPosition : SnapshotPoint, 
    verticalDistance : double, 
    relativeTo : ViewRelativePosition, 
    viewportWidthOverride : Nullable<double>, 
    viewportHeightOverride : Nullable<double>
)

Parameters

  • verticalDistance
    Type: System.Double
    The distance (in pixels) between the ITextViewLine and the edge of the view. If relativeTo is equal to ViewRelativePosition.Top, then the distance is from the top of the view to the top of the ITextViewLine. Otherwise, it is the distance from the bottom of the ITextViewLine to the bottom on the view.
    Negative values are allowed, which may cause the line to be displayed outside the viewport.
    This method can become quite expensive if verticalDistance is large. You should avoid making verticalDistance greater than the height of the view.
  • viewportWidthOverride
    Type: System.Nullable<Double>
    If specified, the text is formatted as if the viewport had the specified width.
  • viewportHeightOverride
    Type: System.Nullable<Double>
    If specified, the text is formatted as if the viewport had the specified height.

Exceptions

Exception Condition
ArgumentException

bufferPosition is from the wrong ITextSnapshot or ITextBuffer.

ArgumentOutOfRangeException

relativeTo is not a valid ViewRelativePosition.

Remarks

If word wrap is disabled in the view, then the ITextViewLine corresponds to the entire ITextSnapshotLine that contains bufferPosition. If word wrap is enabled in the view, then the ITextViewLine corresponds to the portion of the ITextSnapshotLine that both contains bufferPosition and fits into the view. bufferPosition may not be the first character in the ITextViewLine. The returned value is generally equal to verticalDistance, except where the view was repositioned to prevent a gap from appearing at the top or bottom of the view. Calling this method causes the view to dispose of its current TextViewLines. The viewport width override will have no effect unless word wrap is enabled in the view. The viewport height and width overrides only change how text is formatted for this call. Subsequent calls will use the width and height of the viewport (unless explicitly overridden a second time).

.NET Framework Security

See Also

Reference

ITextView Interface

DisplayTextLineContainingBufferPosition Overload

Microsoft.VisualStudio.Text.Editor Namespace