TextSelection.ActivePoint 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取选定内容的当前终结点。
public:
property EnvDTE::VirtualPoint ^ ActivePoint { EnvDTE::VirtualPoint ^ get(); };
public:
property EnvDTE::VirtualPoint ^ ActivePoint { EnvDTE::VirtualPoint ^ get(); };
[System.Runtime.InteropServices.DispId(4)]
public EnvDTE.VirtualPoint ActivePoint { [System.Runtime.InteropServices.DispId(4)] get; }
[<System.Runtime.InteropServices.DispId(4)>]
[<get: System.Runtime.InteropServices.DispId(4)>]
member this.ActivePoint : EnvDTE.VirtualPoint
Public ReadOnly Property ActivePoint As VirtualPoint
属性值
VirtualPoint 对象。
- 属性
示例
Sub ActivePointExample()
' 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.")
End Sub
注解
尽管 TextPoint 对象指示选定文本在 编辑器 窗口中的位置,但它们不会在缓冲区中标记位置。 虚拟空间—行尾之外的区域,也只在 编辑器 窗口中进行跟踪。 因此,在 EditPoint 文本缓冲区中使用对象修改文本时,未定义文本选择会发生什么情况。 例如,命令可以从文本选择开始,获取编辑点,然后更改缓冲区。 若要确保文本选择位于某个位置,你必须将选择的文本放在命令末尾的位置。