VirtualPoint.VirtualCharOffset 属性

获取虚空格中虚拟点的列索引。

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

语法

声明
ReadOnly Property VirtualCharOffset As Integer
int VirtualCharOffset { get; }
property int VirtualCharOffset {
    int get ();
}
abstract VirtualCharOffset : int
function get VirtualCharOffset () : int

属性值

类型:System.Int32
一个整数值,指示虚空格中虚拟点的列索引。

备注

字符编号从 1 开始。VirtualCharOffset 返回虚拟点距离文档中一行的左侧的字符数。

示例

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

.NET Framework 安全性

请参见

参考

VirtualPoint 接口

EnvDTE 命名空间