Compartir a través de


IVsTextView Interface

Manages the text view of an editor window and contains methods to manage the text view. The view is essentially the editor window shown in the user interface (UI).

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

Syntax

'Declaración
<InterfaceTypeAttribute()> _
<GuidAttribute("BB23A14B-7C61-469A-9890-A95648CED5E6")> _
Public Interface IVsTextView
[InterfaceTypeAttribute()]
[GuidAttribute("BB23A14B-7C61-469A-9890-A95648CED5E6")]
public interface IVsTextView
[InterfaceTypeAttribute()]
[GuidAttribute(L"BB23A14B-7C61-469A-9890-A95648CED5E6")]
public interface class IVsTextView
[<InterfaceTypeAttribute()>]
[<GuidAttribute("BB23A14B-7C61-469A-9890-A95648CED5E6")>]
type IVsTextView =  interface end
public interface IVsTextView

The IVsTextView type exposes the following members.

Methods

  Name Description
Public method AddCommandFilter Adds a command filter to the existing chain of command filters.
Public method CenterColumns Places the specified column of text in the center of the view.
Public method CenterLines Places the specified lines of text in the center of the view.
Public method ClearSelection Clears the current selection.
Public method CloseView Closes and unregisters a view with the view manager.
Public method EnsureSpanVisible Ensures that text is in view, both vertically and horizontally.
Public method GetBuffer Returns the current contents of the text buffer.
Public method GetCaretPos Returns the line and column index of the cursor position.
Public method GetLineAndColumn Converts a text stream position to a line and column index.
Public method GetLineHeight Returns the pixel height of a line.
Public method GetNearestPosition Converts a line and column index to a text stream position.
Public method GetPointOfLineColumn Returns the coordinates for the upper left corner of a particular line and column.
Public method GetScrollInfo Returns the core text editor's scroll bar settings for the specified scroll bar.
Public method GetSelectedText Returns a copy of the selected text.
Public method GetSelection Returns the text span corresponding to the current selection, if there is one.
Public method GetSelectionDataObject Returns a copy of the selected text in IDataObject interface format.
Public method GetSelectionMode Returns the current selection mode.
Public method GetSelectionSpan Returns the text span associated with a selection.
Public method GetTextStream Returns a specified stream of text in a string.
Public method GetWindowHandle Returns the window handle for this view.
Public method GetWordExtent Returns the current word extent.
Public method HighlightMatchingBrace Highlights the matching brace in a language construct.
Public method Initialize Creates the view and allows clients to specify one or more TextViewInitFlags options.
Public method PositionCaretForEditing Puts the caret in a position suitable for editing a function.
Public method RemoveCommandFilter Removes a command filter from the chain of command filters.
Public method ReplaceTextOnLine Replaces line text.
Public method RestrictViewRange Reduces the view’s range of visible/editable lines to a subset of the buffer’s lines.
Public method SendExplicitFocus Sends explicit focus to the window.
Public method SetBuffer Associates a text buffer with the view.
Public method SetCaretPos Sets the coordinates of the end point of a selection.
Public method SetScrollPosition Sets the core text editor's scroll bar settings for the specified scroll bar.
Public method SetSelection Selects specified text.
Public method SetSelectionMode Sets the selection mode.
Public method SetTopLine Sets the top line in the view to the baseline.
Public method UpdateCompletionStatus Used for word completion control.
Public method UpdateTipWindow Updates the tip window.
Public method UpdateViewFrameCaption Forces the view to update its frame window caption, such as "[Read only]".

Top

Remarks

The IVsTextView interface is not the MDI child, but an individual window of text. If a splitter is involved, there can be multiple views in an MDI child. The term, caret, refers to the text insertion point, while the term, cursor, refers to the mouse pointer.

Warning

This interface is not thread-safe. You should not call anything on this interface from anything but the main UI thread.

If you need to perform any operations on the view from a different thread, you may either:

Some methods on IVsTextViewuse ViewCol coordinates (for example, GetTextStream and GetCaretPos), while others use CharIndex coordinates (for example, GetWordExtent). ViewCol coordinates may include virtual space while CharIndex coordinates are only an offset into a buffer line and never include virtual space.

If you get a coordinate in ViewCol coordinates, then you should only call methods that take CharIndex coordinates after making sure that the ViewCol coordinate does not lie in the virtual space region. For example, if you call the following:

long iLine;

long cCount;

ViewCol iCol;

IVsTextView::SomeMethod(&iLine, &icol);

Then you must check to be sure that the following is true:

IVsTextBuffer::GetLengthOfLine(iLine, &cCount);

iCol < cCount

Then call the following:

IVsTextView::SomeOtherMethod(ViewCol(iCol ))

// where SomeOtherMethod takes ViewCol coordinates

See illustrations of the implementation and/or calling of this interface in the sample Figures Language Service.

Notes to Callers

Called by clients who want to manage their view.

See Also

Reference

Microsoft.VisualStudio.TextManager.Interop Namespace