VirtualPoint 接口

使您得以操作文本文档的右边距(双向 Windows 中的左边距)以外的文本。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
<GuidAttribute("42320454-626C-4DD0-9ECB-357C4F1966D8")> _
Public Interface VirtualPoint _
    Inherits TextPoint
[GuidAttribute("42320454-626C-4DD0-9ECB-357C4F1966D8")]
public interface VirtualPoint : TextPoint
[GuidAttribute(L"42320454-626C-4DD0-9ECB-357C4F1966D8")]
public interface class VirtualPoint : TextPoint
[<GuidAttribute("42320454-626C-4DD0-9ECB-357C4F1966D8")>]
type VirtualPoint =  
    interface 
        interface TextPoint 
    end
public interface VirtualPoint extends TextPoint

VirtualPoint 类型公开以下成员。

属性

  名称 说明
公共属性 AbsoluteCharOffset 获取文档开头到对象的字符偏移量,从 1 开始。
公共属性 AtEndOfDocument 如果对象在文档的结尾,则返回 true。
公共属性 AtEndOfLine 如果对象在行尾,则返回 true。
公共属性 AtStartOfDocument 如果对象在文档开头,则返回 true。
公共属性 AtStartOfLine 如果对象在行首,则返回 true。
公共属性 CodeElement 返回 VirtualPoint 位置处的代码元素。
公共属性 DisplayColumn 获取包含对象的当前显示列的编号。
公共属性 DTE 获取顶级扩展性对象。
公共属性 Line 获取对象的行号。
公共属性 LineCharOffset 获取对象的字符偏移量。
公共属性 LineLength 获取包含对象的行中的字符数,不包括换行符。
公共属性 Parent 获取 VirtualPoint 对象的直接父对象。
公共属性 VirtualCharOffset 获取虚空格中虚拟点的列索引。
公共属性 VirtualDisplayColumn 获取当前位置的显示列。

页首

方法

  名称 说明
公共方法 CreateEditPoint 在调用对象的位置创建并返回一个 EditPoint 对象。
公共方法 EqualTo 返回一个值,指示给定 TextPoint 对象的 AbsoluteCharOffset 属性的值是否等于调用 VirtualPoint 对象的该属性值。
公共方法 GreaterThan 返回一个值,它指示调用对象的 AbsoluteCharOffset 属性值是否大于给定点对象的该属性值。
公共方法 LessThan 返回一个值,它指示被调用对象的 AbsoluteCharOffset 属性值是否小于给定对象的该属性值。
公共方法 TryToShow 尝试显示文本点的位置。

页首

备注

VirtualPoint 对象与 TextPoint 对象相似,但前者可以查询文档中的虚空格。 VirtualPoint 对象由 TextSelection.StartPoint 和 TextSelection.EndPoint 返回。

虚空格是现有文本行右边的空白,虚拟点即存在于该区域中。

示例

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.
   objSel.StartOfLine()
   ' 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.
   objSel.EndOfLine()

   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

请参阅

参考

EnvDTE 命名空间