ITextViewLineCollection Interface

Represents a helper class for accessing the view's collection of ITextViewLine objects. The TextViewLines property is used to get an instance of this interface.

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

Syntax

声明
Public Interface ITextViewLineCollection _
    Inherits IList(Of ITextViewLine), ICollection(Of ITextViewLine),  _
    IEnumerable(Of ITextViewLine), IEnumerable
public interface ITextViewLineCollection : IList<ITextViewLine>, 
    ICollection<ITextViewLine>, IEnumerable<ITextViewLine>, IEnumerable
public interface class ITextViewLineCollection : IList<ITextViewLine^>, 
    ICollection<ITextViewLine^>, IEnumerable<ITextViewLine^>, IEnumerable
type ITextViewLineCollection =  
    interface
        interface IList<ITextViewLine>
        interface ICollection<ITextViewLine>
        interface IEnumerable<ITextViewLine>
        interface IEnumerable
    end
public interface ITextViewLineCollection extends IList<ITextViewLine>, ICollection<ITextViewLine>, IEnumerable<ITextViewLine>, IEnumerable

The ITextViewLineCollection type exposes the following members.

Properties

  Name Description
Public property Count Gets the number of elements contained in the ICollection<T>. (Inherited from ICollection<ITextViewLine>.)
Public property FirstVisibleLine Gets the first line that is not completely hidden.
Public property FormattedSpan Gets the span of text contained in this ITextViewLine collection.
Public property IsReadOnly Gets a value indicating whether the ICollection<T> is read-only. (Inherited from ICollection<ITextViewLine>.)
Public property IsValid Determines whether this ITextViewLineCollection object is still valid.
Public property Item Gets or sets the element at the specified index. (Inherited from IList<ITextViewLine>.)
Public property LastVisibleLine Gets the last line that is not completely hidden.

Top

Methods

  Name Description
Public method Add Adds an item to the ICollection<T>. (Inherited from ICollection<ITextViewLine>.)
Public method Clear Removes all items from the ICollection<T>. (Inherited from ICollection<ITextViewLine>.)
Public method Contains Determines whether the ICollection<T> contains a specific value. (Inherited from ICollection<ITextViewLine>.)
Public method ContainsBufferPosition Determines whether the specified buffer position is contained by any of the ITextViewLine objects in the collection.
Public method CopyTo Copies the elements of the ICollection<T> to an Array, starting at a particular Array index. (Inherited from ICollection<ITextViewLine>.)
Public method GetCharacterBounds Gets the text bounds of the specified text buffer position.
Public method GetEnumerator() Returns an enumerator that iterates through the collection. (Inherited from IEnumerable<ITextViewLine>.)
Public method GetEnumerator() Returns an enumerator that iterates through a collection. (Inherited from IEnumerable.)
Public method GetIndexOfTextLine Gets the index in the text lines of the given text view line.
Public method GetNormalizedTextBounds Gets a collection of TextBounds structures for the text that corresponds to the given span.
Public method GetTextElementSpan Gets the span whose text element span contains the given buffer position.
Public method GetTextViewLineContainingBufferPosition Gets the ITextViewLine that contains the specified text buffer position.
Public method GetTextViewLineContainingYCoordinate Gets the ITextViewLine that contains the specified y-coordinate.
Public method GetTextViewLinesIntersectingSpan Gets all of the ITextViewLine objects that intersect bufferSpan.
Public method IndexOf Determines the index of a specific item in the IList<T>. (Inherited from IList<ITextViewLine>.)
Public method Insert Inserts an item to the IList<T> at the specified index. (Inherited from IList<ITextViewLine>.)
Public method IntersectsBufferSpan Determines whether the specified buffer span intersects any of the ITextViewLine objects in the collection.
Public method Remove Removes the first occurrence of a specific object from the ICollection<T>. (Inherited from ICollection<ITextViewLine>.)
Public method RemoveAt Removes the IList<T> item at the specified index. (Inherited from IList<ITextViewLine>.)

Top

Remarks

The ITextView disposes its ITextViewLineCollection and all the ITextViewLine objects it contains every time it generates a new layout.

Most properties and parameters that are doubles correspond to coordinates or distances in the text rendering coordinate system. In this coordinate system, x = 0.0 corresponds to the left edge of the drawing surface onto which text is rendered (x = view.ViewportLeft corresponds to the left edge of the viewport), and y = view.ViewportTop corresponds to the top edge of the viewport. The x-coordinate increases from left to right, and the y-coordinate increases from top to bottom. The horizontal and vertical axes of the view behave differently. When the text in the view is formatted, only the visible lines are formatted. As a result, a viewport cannot be scrolled horizontally and vertically in the same way. A viewport is scrolled horizontally by changing the left coordinate of the viewport so that it moves with respect to the drawing surface. A view can be scrolled vertically only by performing a new layout. Doing a layout in the view may cause the ViewportTop property of the view to change.

For example, scrolling down one line will not translate any of the visible lines. Instead it will simply change the ViewportTop property (causing the lines to move on the screen even though their y-coordinates have not changed). Distances in the text rendering coordinate system correspond to logical pixels. If the text rendering surface is displayed without any scaling transform, then 1 unit in the text rendering coordinate system corresponds to one pixel on the display.

See Also

Reference

Microsoft.VisualStudio.Text.Editor Namespace