TextSelection.StartOfLine(vsStartOfLineOptions, Boolean) 方法

定义

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

void StartOfLine(EnvDTE::vsStartOfLineOptions Where = EnvDTE.vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn, bool Extend = false);
[System.Runtime.InteropServices.DispId(27)]
public void StartOfLine (EnvDTE.vsStartOfLineOptions Where = EnvDTE.vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn, bool Extend = false);
[<System.Runtime.InteropServices.DispId(27)>]
abstract member StartOfLine : EnvDTE.vsStartOfLineOptions * bool -> unit
Public Sub StartOfLine (Optional Where As vsStartOfLineOptions = EnvDTE.vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn, Optional Extend As Boolean = false)

参数

Where
vsStartOfLineOptions

可选。 一个 vsStartOfLineOptions 常数,表示行的起始位置。

Extend
Boolean

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

属性

示例

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  

注解

如果 ExtendTrue ,则仅将选定文本的活动端移动到文档的开头。 否则,文本选择将折叠并移动。

适用于