共用方式為


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 相同。

如果 Unindent 的值大於或等於 10,000,則 Count 會失敗。

範例

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 命名空間