Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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)

[InterfaceTypeAttribute(1)] 
[GuidAttribute("BB23A14B-7C61-469A-9890-A95648CED5E6")] 
public interface IVsTextView
/** @attribute InterfaceTypeAttribute(1) */ 
/** @attribute GuidAttribute("BB23A14B-7C61-469A-9890-A95648CED5E6") */ 
public interface IVsTextView
InterfaceTypeAttribute(1) 
GuidAttribute("BB23A14B-7C61-469A-9890-A95648CED5E6") 
public interface IVsTextView

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.

Caution noteCaution

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 Sample.

Notes to Callers Called by clients who want to manage their view.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft