We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

VirtualPoint Interface

Allows you to manipulate text beyond the right margin (left margin in bidirectional Windows) of the text document.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

public interface VirtualPoint : TextPoint

The VirtualPoint type exposes the following members.

Public propertyAbsoluteCharOffsetGets the one-based character offset from the beginning of the document to the object.
Public propertyAtEndOfDocumentReturns true if the object is at the end of the document.
Public propertyAtEndOfLineReturns true if the object is at the end of a line.
Public propertyAtStartOfDocumentReturns true if the object is at the beginning of the document.
Public propertyAtStartOfLineReturns true if the object is at the beginning of a line.
Public propertyCodeElementReturns the code element at the VirtualPoint location.
Public propertyDisplayColumnGets the number of the current displayed column containing the object.
Public propertyDTEGets the top-level extensibility object.
Public propertyLineGets the line number of the object.
Public propertyLineCharOffsetGets the character offset of the object.
Public propertyLineLengthGets the number of characters in a line containing the object, excluding the new line character.
Public propertyParentGets the immediate parent object of a VirtualPoint object.
Public propertyVirtualCharOffsetGets the column index of a virtual point in virtual space.
Public propertyVirtualDisplayColumnGets the display column of the current position.

Public methodCreateEditPointCreates and returns an EditPoint object at the location of the calling object.
Public methodEqualToReturns whether the value of the given TextPoint object's AbsoluteCharOffset property is equal to that of the calling VirtualPoint object.
Public methodGreaterThanReturns whether the value of the calling object's AbsoluteCharOffset property is greater than that of the given point object.
Public methodLessThanReturns whether the value of the called object's AbsoluteCharOffset property is less than that of the given object.
Public methodTryToShowAttempts to display the text point's location.

VirtualPoint objects are similar to the TextPoint object except that they can query virtual space in a document. VirtualPoint objects are returned by TextSelection.StartPoint and TextSelection.EndPoint.

Virtual space is the empty space to the right of existing lines of text, and virtual points exist in this area.

Sub VirtualPointExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   Dim objActive As VirtualPoint = objSel.ActivePoint
   ' Collapse the selection to the beginning of the line.
   ' objActive is "live", tied to the position of the actual selection, 
   ' so it will reflect the new position.
   Dim iCol As Long = objActive.DisplayColumn
   ' Move the selection to the end of the line.

   MsgBox("The length of the insertion point line is " & (objActive.DisplayColumn - iCol) & " display characters.")
   MsgBox("VirtualCharOffset value: " & objActive.VirtualCharOffset & vbCr & "VirtualDisplayColumn value: " & objActive.VirtualDisplayColumn)
End Sub