TextSelection.LineUp 方法

更新:2007 年 11 月

将文本选择的插入点按指定的行数上移。

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

语法

声明
Sub LineUp ( _
    Extend As Boolean, _
    Count As Integer _
)
用法
Dim instance As TextSelection
Dim Extend As Boolean
Dim Count As Integer

instance.LineUp(Extend, Count)
void LineUp(
    bool Extend,
    int Count
)
void LineUp(
    [InAttribute] bool Extend, 
    [InAttribute] int Count
)
function LineUp(
    Extend : boolean, 
    Count : int
)

参数

  • Extend
    类型:System.Boolean

    可选。确定是否突出显示插入点在其中移动的行。默认值为 false。

  • Count
    类型:System.Int32

    可选。指示将插入点上移的行数。默认值为 1。

备注

LineUp 将选定文本的插入点从其当前位置上移 Count 行。如果 Extend 为 true,那么移动插入点后将突出显示新行。如果在 Count 行之前达到文档开头,则定位到文档开头。LineUp 会试图将显示列从原始行匹配到目标行,并且如果结束位置在目标行中某制表符的中间,在必要的时候,它将舍去一个字符位置。

如果 Count 的值为负,则 LineUp 的执行类似于 LineDown 方法。

示例

Sub LineUpExample()
   ' Before running this example, open a text document containing
   ' at least 4 lines of text.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   ' Go to fourth line in document and then move up one line.
   objSel.GotoLine(4, False)
   objSel.LineUp(True, 1)
End Sub

权限

另请参见

参考

TextSelection 接口

TextSelection 成员

EnvDTE 命名空间