Partilhar via


ITextView.DisplayTextLineContainingBufferPosition Method

Definition

Overloads

DisplayTextLineContainingBufferPosition(SnapshotPoint, Double, ViewRelativePosition)

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

DisplayTextLineContainingBufferPosition(SnapshotPoint, Double, ViewRelativePosition, Nullable<Double>, Nullable<Double>)

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

DisplayTextLineContainingBufferPosition(SnapshotPoint, Double, ViewRelativePosition)

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

public:
 void DisplayTextLineContainingBufferPosition(Microsoft::VisualStudio::Text::SnapshotPoint bufferPosition, double verticalDistance, Microsoft::VisualStudio::Text::Editor::ViewRelativePosition relativeTo);
public void DisplayTextLineContainingBufferPosition (Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition, double verticalDistance, Microsoft.VisualStudio.Text.Editor.ViewRelativePosition relativeTo);
abstract member DisplayTextLineContainingBufferPosition : Microsoft.VisualStudio.Text.SnapshotPoint * double * Microsoft.VisualStudio.Text.Editor.ViewRelativePosition -> unit
Public Sub DisplayTextLineContainingBufferPosition (bufferPosition As SnapshotPoint, verticalDistance As Double, relativeTo As ViewRelativePosition)

Parameters

bufferPosition
SnapshotPoint

The position of the character that is to be contained in the ITextViewLine displayed at the specified vertical position.

verticalDistance
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 might 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.

relativeTo
ViewRelativePosition

Specifies whether the line offset is relative to the top or bottom of the view.

Exceptions

bufferPosition is from the wrong ITextSnapshot or ITextBuffer.

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 will generally be equal to verticalDistance, except in cases where the view was repositioned to prevent a gap from appearing at the top or bottom of the view.

Calling this method will cause the view to dispose of its current TextViewLines.

Applies to

DisplayTextLineContainingBufferPosition(SnapshotPoint, Double, ViewRelativePosition, Nullable<Double>, Nullable<Double>)

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

public:
 void DisplayTextLineContainingBufferPosition(Microsoft::VisualStudio::Text::SnapshotPoint bufferPosition, double verticalDistance, Microsoft::VisualStudio::Text::Editor::ViewRelativePosition relativeTo, Nullable<double> viewportWidthOverride, Nullable<double> viewportHeightOverride);
public void DisplayTextLineContainingBufferPosition (Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition, double verticalDistance, Microsoft.VisualStudio.Text.Editor.ViewRelativePosition relativeTo, double? viewportWidthOverride, double? viewportHeightOverride);
abstract member DisplayTextLineContainingBufferPosition : Microsoft.VisualStudio.Text.SnapshotPoint * double * Microsoft.VisualStudio.Text.Editor.ViewRelativePosition * Nullable<double> * Nullable<double> -> unit
Public Sub DisplayTextLineContainingBufferPosition (bufferPosition As SnapshotPoint, verticalDistance As Double, relativeTo As ViewRelativePosition, viewportWidthOverride As Nullable(Of Double), viewportHeightOverride As Nullable(Of Double))

Parameters

bufferPosition
SnapshotPoint

The position of the character that is to be contained in the ITextViewLine displayed at the specified vertical position.

verticalDistance
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 might 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.

relativeTo
ViewRelativePosition

Specifies whether the line offset is relative to the top or bottom of the view.

viewportWidthOverride
Nullable<Double>

If specified, the text is formatted as if the viewport had the specified width.

viewportHeightOverride
Nullable<Double>

If specified, the text is formatted as if the viewport had the specified height.

Exceptions

bufferPosition is from the wrong ITextSnapshot or ITextBuffer.

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 will generally be equal to verticalDistance, except in cases where the view was repositioned to prevent a gap from appearing at the top or bottom of the view.

Calling this method will cause 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 overriden a second time).

Applies to