TextSelection.Unindent 方法

按照给定的缩进级别数从选定的文本中移除缩进。

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

语法

声明
Sub Unindent ( _
    Count As Integer _
)
void Unindent(
    int Count
)
void Unindent(
    [InAttribute] int Count
)
abstract Unindent : 
        Count:int -> unit 
function Unindent(
    Count : int
)

参数

  • Count
    类型:System.Int32
    可选。要从选定文本中的每一行移除的显示缩进级别数。默认值为 1。

备注

Unindent 将选定文本的缩进移除一个缩进级别的显示列数(由全局设置指定)。 Unindent 不会基于代码的上下文执行智能格式化或删除行缩进。 根据当前制表符和缩进级别大小的全局设置,必要时删除和插入制表符及字符以移除一个缩进级别。

根据选定文本是连续的还是纵栏式的,Unindent 的行为有所不同。 如果是连续的,则从选定内容中的所有行,无论是部分行还是完整行,都从第一列开始移除缩进。 如果是纵栏式选定内容,则从选定内容的左边缘开始移除选定文本的缩进。

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

如果 Count 的值大于或等于 10,000,则 Unindent 失败。

示例

Sub UnIndentExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   ' Go to first line in document and indent it.
   objSel.GotoLine(1, False)
   objSel.Indent(2)
   MsgBox("Indented two places, now unindenting one place...")
   objSel.Unindent(1)
End Sub

.NET Framework 安全性

请参见

参考

TextSelection 接口

EnvDTE 命名空间