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
    类型: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 命名空间