TextSelection.StartOfLine 方法

更新:2007 年 11 月

将对象移到当前行的开头。

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

语法

声明
Sub StartOfLine ( _
    Where As vsStartOfLineOptions, _
    Extend As Boolean _
)
用法
Dim instance As TextSelection
Dim Where As vsStartOfLineOptions
Dim Extend As Boolean

instance.StartOfLine(Where, Extend)
void StartOfLine(
    vsStartOfLineOptions Where,
    bool Extend
)
void StartOfLine(
    [InAttribute] vsStartOfLineOptions Where, 
    [InAttribute] bool Extend
)
function StartOfLine(
    Where : vsStartOfLineOptions, 
    Extend : boolean
)

参数

  • Extend
    类型:System.Boolean

    可选。确定所移动的文本是否折叠。默认值为 false。

备注

如果 Extend 为 True,则只将选定文本的活动端移到文档开头。否则,折叠并移动选定文本。

示例

Sub StartOfLineExample()
   ' 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

权限

另请参见

参考

TextSelection 接口

TextSelection 成员

EnvDTE 命名空间